null+****@clear*****
null+****@clear*****
2010年 6月 25日 (金) 09:17:51 JST
Kouhei Sutou 2010-06-25 00:17:51 +0000 (Fri, 25 Jun 2010)
New Revision: 4ba67efa9d5fb367d108cd199c06053a845c6dcc
Log:
add a test for integer key load. #362
Modified files:
test/unit/core/test-command-load.c
Modified: test/unit/core/test-command-load.c (+22 -1)
===================================================================
--- test/unit/core/test-command-load.c 2010-06-25 00:15:43 +0000 (ec97fac)
+++ test/unit/core/test-command-load.c 2010-06-25 00:17:51 +0000 (b48b363)
@@ -27,6 +27,7 @@ void test_columns(void);
void attributes_bool(void);
void data_bool(void);
void test_bool(gconstpointer data);
+void test_int32_key(void);
static gchar *tmp_directory;
@@ -133,7 +134,7 @@ data_bool(void)
" [\"mori\",1],\n"
" [\"tapo\",0]\n"
"]");
- ADD_DATUM("string (is this test OK?)",
+ ADD_DATUM("string",
"load --table Users --columns '_key,enabled'\n"
"[\n"
" [\"mori\",\"1\"],\n"
@@ -168,3 +169,23 @@ test_bool(gconstpointer data)
"]]",
send_command("select Users"));
}
+
+void
+test_int32_key(void)
+{
+ assert_send_command("table_create Students TABLE_HASH_KEY Int32");
+ assert_send_command("column_create Students name COLUMN_SCALAR ShortText");
+ cut_assert_equal_string(
+ "1",
+ send_command("load --table Students\n"
+ "[{\"_key\": 1, \"name\": \"morita\"}]"));
+ cut_assert_equal_string("[[[1],"
+ "["
+ "[\"_id\",\"UInt32\"],"
+ "[\"_key\",\"Int32\"],"
+ "[\"name\",\"ShortText\"]"
+ "],"
+ "[1,1,\"morita\"]"
+ "]]",
+ send_command("select Students"));
+}