Kosuke Asami
null+****@clear*****
Wed Jan 13 17:20:10 JST 2016
Kosuke Asami 2013-07-11 15:29:18 +0900 (Thu, 11 Jul 2013) New Revision: d83c7671dd0468532f9ce17a6f767287fc5da5ae https://github.com/groonga/groonga-command/commit/d83c7671dd0468532f9ce17a6f767287fc5da5ae Message: test table_create: add table_no_key predicate Modified files: lib/groonga/command/table-create.rb test/command/test-table-create.rb Modified: lib/groonga/command/table-create.rb (+4 -0) =================================================================== --- lib/groonga/command/table-create.rb 2013-07-11 15:12:11 +0900 (872b2df) +++ lib/groonga/command/table-create.rb 2013-07-11 15:29:18 +0900 (73aaab3) @@ -38,6 +38,10 @@ module Groonga def flags @flags ||= (self[:flags] || "").split(/\s*\|\s*/) end + + def table_no_key? + flags.include?("TABLE_NO_KEY") + end end end end Modified: test/command/test-table-create.rb (+17 -0) =================================================================== --- test/command/test-table-create.rb 2013-07-11 15:12:11 +0900 (d019300) +++ test/command/test-table-create.rb 2013-07-11 15:29:18 +0900 (29da38c) @@ -61,6 +61,23 @@ class TableCreateCommandTest < Test::Unit::TestCase command = parse({}) assert_equal([], command.flags) end + + class PredicateTest < self + data({ + "TABLE_NO_KEY" => { + :expected => true, + :flags => "TABLE_NO_KEY", + }, + "other flag" => { + :expected => false, + :flags => "TABLE_HASH_KEY", + } + }) + def test_table_no_key?(data) + command = parse({"flags" => data[:flags]}) + assert_equal(data[:expected], command.table_no_key?) + end + end end end end -------------- next part -------------- HTML����������������������������...Download