null+****@clear*****
null+****@clear*****
2010年 12月 21日 (火) 17:55:47 JST
Kouhei Sutou 2010-12-21 08:55:47 +0000 (Tue, 21 Dec 2010)
New Revision: 5a5d00af086769b17d2c14654aeab1ab50d8c7b9
Log:
add a test for nonexisting ID deleting breaks NO_KEY table. #794
Reported and patched by Masahiro Tomita. Thanks!!!
Modified files:
test/unit/core/test-command-delete.c
Modified: test/unit/core/test-command-delete.c (+24 -0)
===================================================================
--- test/unit/core/test-command-delete.c 2010-12-21 07:59:03 +0000 (9c733ad)
+++ test/unit/core/test-command-delete.c 2010-12-21 08:55:47 +0000 (8507bf9)
@@ -28,6 +28,7 @@ void test_by_key(void);
void test_referenced_record(void);
void test_uint64(void);
void test_last_token(void);
+void test_no_key_twice(void);
static gchar *tmp_directory;
@@ -188,3 +189,26 @@ test_last_token(void)
"--query o "
"--output_columns _key"));
}
+
+void
+test_no_key_twice(void)
+{
+ assert_send_command("table_create Sites TABLE_NO_KEY");
+ assert_send_command("column_create Sites title COLUMN_SCALAR ShortText");
+ assert_send_command("delete Sites --id 999");
+ assert_send_command("delete Sites --id 999");
+ cut_assert_equal_string("3",
+ send_command("load --table Sites\n"
+ "[\n"
+ "{\"title\": \"groonga\"},\n"
+ "{\"title\": \"Ruby\"},\n"
+ "{\"title\": \"Cutter\"}\n"
+ "]"));
+ cut_assert_equal_string("[[[3],"
+ "[[\"_id\",\"UInt32\"],"
+ "[\"title\",\"ShortText\"]],"
+ "[1,\"groonga\"],"
+ "[2,\"Ruby\"],"
+ "[3,\"Cutter\"]]]",
+ send_command("select Sites"));
+}