From 93f4f8eb1824e325d2739244f375413351ddaaa0 Mon Sep 17 00:00:00 2001 From: Alexey Romanov Date: Thu, 18 Nov 2010 17:39:36 +0300 Subject: [PATCH] Added test --- c_src/sqlite3_drv.c | 1 + test/sqlite3_test.erl | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/c_src/sqlite3_drv.c b/c_src/sqlite3_drv.c index 4ff5115..793243a 100644 --- a/c_src/sqlite3_drv.c +++ b/c_src/sqlite3_drv.c @@ -1,4 +1,5 @@ #include "sqlite3_drv.h" +#include "ei.h" // MSVC needs "__inline" instead of "inline" in C-source files. #if defined(_MSC_VER) diff --git a/test/sqlite3_test.erl b/test/sqlite3_test.erl index 6494fcd..65e28d2 100644 --- a/test/sqlite3_test.erl +++ b/test/sqlite3_test.erl @@ -56,7 +56,7 @@ basic_functionality() -> Columns = ["id", "name", "age", "wage"], AllRows = [{1, <<"abby">>, 20, 2000}, {2, <<"marge">>, 30, 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), ?assertEqual( [], @@ -74,6 +74,9 @@ basic_functionality() -> ?assertEqual( {id, 2}, 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( [{columns, Columns}, {rows, AllRows}], sqlite3:sql_exec(ct, "select * from user;")),