null+****@clear*****
null+****@clear*****
2011年 12月 19日 (月) 17:24:53 JST
Kouhei Sutou 2011-12-19 08:24:53 +0000 (Mon, 19 Dec 2011)
New Revision: 0bb84b032f74066647051c5fb34a96f4abf4b088
Log:
[shcema][table-create] add tags.
refs #915
refs #1210
Modified files:
lib/proc.c
test/unit/http/test-http-schema.rb
Modified: lib/proc.c (+6 -3)
===================================================================
--- lib/proc.c 2011-12-19 08:16:14 +0000 (f297073)
+++ lib/proc.c 2011-12-19 08:24:53 +0000 (fba6548)
@@ -799,7 +799,8 @@ proc_table_create(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_d
GRN_TEXT_LEN(VAR(2)));
if (!key_type) {
ERR(GRN_INVALID_ARGUMENT,
- "key type doesn't exist: <%.*s>",
+ "[table][create] key type doesn't exist: <%.*s> (%.*s)",
+ GRN_TEXT_LEN(VAR(0)), GRN_TEXT_VALUE(VAR(0)),
GRN_TEXT_LEN(VAR(2)), GRN_TEXT_VALUE(VAR(2)));
return NULL;
}
@@ -809,7 +810,8 @@ proc_table_create(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_d
GRN_TEXT_LEN(VAR(3)));
if (!value_type) {
ERR(GRN_INVALID_ARGUMENT,
- "value type doesn't exist: <%.*s>",
+ "[table][create] value type doesn't exist: <%.*s> (%.*s)",
+ GRN_TEXT_LEN(VAR(0)), GRN_TEXT_VALUE(VAR(0)),
GRN_TEXT_LEN(VAR(3)), GRN_TEXT_VALUE(VAR(3)));
return NULL;
}
@@ -829,7 +831,8 @@ proc_table_create(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_d
grn_obj_unlink(ctx, table);
}
} else {
- ERR(GRN_INVALID_ARGUMENT, "should not create anonymous table");
+ ERR(GRN_INVALID_ARGUMENT,
+ "[table][create] should not create anonymous table");
}
exit:
GRN_OUTPUT_BOOL(!ctx->rc);
Modified: test/unit/http/test-http-schema.rb (+17 -6)
===================================================================
--- test/unit/http/test-http-schema.rb 2011-12-19 08:16:14 +0000 (f6f2d4f)
+++ test/unit/http/test-http-schema.rb 2011-12-19 08:24:53 +0000 (d82e55f)
@@ -191,7 +191,8 @@ class HTTPSchemaTest < Test::Unit::TestCase
def test_table_create_without_name
response = get(command_path(:table_create))
assert_error_response(Result::INVALID_ARGUMENT,
- "should not create anonymous table",
+ "[table][create] " +
+ "should not create anonymous table",
response,
:content_type => "application/json")
end
@@ -353,7 +354,9 @@ class HTTPSchemaTest < Test::Unit::TestCase
:name => "users",
:key_type => "nonexistent"))
assert_error_response(Result::INVALID_ARGUMENT,
- "key type doesn't exist: <nonexistent>",
+ "[table][create] " +
+ "key type doesn't exist: " +
+ "<users> (nonexistent)",
response,
:content_type => "application/json")
@@ -388,7 +391,9 @@ class HTTPSchemaTest < Test::Unit::TestCase
:name => "users",
:value_type => "nonexistent"))
assert_error_response(Result::INVALID_ARGUMENT,
- "value type doesn't exist: <nonexistent>",
+ "[table][create] " +
+ "value type doesn't exist: " +
+ "<users> (nonexistent)",
response,
:content_type => "application/json")
@@ -478,7 +483,9 @@ class HTTPSchemaTest < Test::Unit::TestCase
:flags => Table::PAT_KEY,
:key_type => "nonexistent"))
assert_error_response(Result::INVALID_ARGUMENT,
- "key type doesn't exist: <nonexistent>",
+ "[table][create] " +
+ "key type doesn't exist: " +
+ "<users> (nonexistent)",
response,
:content_type => "application/json")
@@ -517,7 +524,9 @@ class HTTPSchemaTest < Test::Unit::TestCase
:flags => Table::PAT_KEY,
:value_type => "nonexistent"))
assert_error_response(Result::INVALID_ARGUMENT,
- "value type doesn't exist: <nonexistent>",
+ "[table][create] " +
+ "value type doesn't exist: " +
+ "<users> (nonexistent)",
response,
:content_type => "application/json")
@@ -614,7 +623,9 @@ class HTTPSchemaTest < Test::Unit::TestCase
:flags => Table::NO_KEY,
:value_type => "nonexistent"))
assert_error_response(Result::INVALID_ARGUMENT,
- "value type doesn't exist: <nonexistent>",
+ "[table][create] " +
+ "value type doesn't exist: " +
+ "<users> (nonexistent)",
response,
:content_type => "application/json")