Added test
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#include "sqlite3_drv.h"
|
#include "sqlite3_drv.h"
|
||||||
|
#include "ei.h"
|
||||||
|
|
||||||
// MSVC needs "__inline" instead of "inline" in C-source files.
|
// MSVC needs "__inline" instead of "inline" in C-source files.
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ basic_functionality() ->
|
|||||||
Columns = ["id", "name", "age", "wage"],
|
Columns = ["id", "name", "age", "wage"],
|
||||||
AllRows = [{1, <<"abby">>, 20, 2000}, {2, <<"marge">>, 30, 2000}],
|
AllRows = [{1, <<"abby">>, 20, 2000}, {2, <<"marge">>, 30, 2000}],
|
||||||
AbbyOnly = [{1, <<"abby">>, 20, 2000}],
|
AbbyOnly = [{1, <<"abby">>, 20, 2000}],
|
||||||
TableInfo = [{id, integer, [primary_key]}, {name, text}, {age, integer}, {wage, integer}],
|
TableInfo = [{id, integer, [primary_key]}, {name, text, [not_null, unique]}, {age, integer}, {wage, integer}],
|
||||||
drop_all_tables(ct),
|
drop_all_tables(ct),
|
||||||
?assertEqual(
|
?assertEqual(
|
||||||
[],
|
[],
|
||||||
@@ -74,6 +74,9 @@ basic_functionality() ->
|
|||||||
?assertEqual(
|
?assertEqual(
|
||||||
{id, 2},
|
{id, 2},
|
||||||
sqlite3:write(ct, user, [{name, "marge"}, {age, 30}, {wage, 2000}])),
|
sqlite3:write(ct, user, [{name, "marge"}, {age, 30}, {wage, 2000}])),
|
||||||
|
?assertEqual(
|
||||||
|
{error, "constraint failed"},
|
||||||
|
sqlite3:write(ct, user, [{name, "marge"}, {age, 30}, {wage, 2000}])),
|
||||||
?assertEqual(
|
?assertEqual(
|
||||||
[{columns, Columns}, {rows, AllRows}],
|
[{columns, Columns}, {rows, AllRows}],
|
||||||
sqlite3:sql_exec(ct, "select * from user;")),
|
sqlite3:sql_exec(ct, "select * from user;")),
|
||||||
|
|||||||
Reference in New Issue
Block a user