20 #include <glib/gstdio.h>
22 #include "../lib/grn-assertions.h"
26 #define get(name) grn_ctx_get(context, name, strlen(name))
35 static gchar *tmp_directory;
36 static const gchar *database_path;
52 g_free(tmp_directory);
56 remove_tmp_directory(
void)
58 cut_remove_path(tmp_directory, NULL);
64 remove_tmp_directory();
65 g_mkdir_with_parents(tmp_directory, 0700);
70 database_path = cut_build_path(tmp_directory,
71 "command-column-rename",
83 remove_tmp_directory();
90 "column_create Users name COLUMN_SCALAR ShortText\n"
91 "load --table Users\n"
93 "[\"_key\",\"name\"],\n"
94 "[\"morita\",\"Daijiro MORI\"],\n"
95 "[\"yata\",\"Susumu Yata\"]\n"
104 cut_assert_equal_string(
105 "table_create Users TABLE_HASH_KEY ShortText\n"
106 "column_create Users full_name COLUMN_SCALAR ShortText\n"
107 "load --table Users\n"
109 "[\"_key\",\"full_name\"],\n"
110 "[\"morita\",\"Daijiro MORI\"],\n"
111 "[\"yata\",\"Susumu Yata\"]\n"
123 "[column][rename] table name isn't specified",
134 "[column][rename] table isn't found: <nonexistent>",
135 "column_rename nonexistent");
145 "[column][rename] column name isn't specified: <Users>",
146 "column_rename Users");
156 "[column][rename] column isn't found: <Users.nonexistent>",
157 "column_rename Users nonexistent");
167 "[column][rename] new column name isn't specified: <Users.name>",
168 "column_rename Users name");