Kosuke Asami
null+****@clear*****
Tue Jul 16 13:24:03 JST 2013
Kosuke Asami 2013-07-16 13:24:03 +0900 (Tue, 16 Jul 2013) New Revision: 091f848081a9496b2cffcfaa0219c6f42e55b611 https://github.com/groonga/groonga-command/commit/091f848081a9496b2cffcfaa0219c6f42e55b611 Message: column_create: add column_scalar predicate Modified files: lib/groonga/command/column-create.rb test/command/test-column-create.rb Modified: lib/groonga/command/column-create.rb (+4 -0) =================================================================== --- lib/groonga/command/column-create.rb 2013-07-16 13:20:11 +0900 (cf66d9f) +++ lib/groonga/command/column-create.rb 2013-07-16 13:24:03 +0900 (2dbc4bc) @@ -38,6 +38,10 @@ module Groonga def flags @flags ||= (self[:flags] || "").split(/\s*\|\s*/) end + + def column_scalar? + flags.include?("COLUMN_SCALAR") + end end end end Modified: test/command/test-column-create.rb (+17 -0) =================================================================== --- test/command/test-column-create.rb 2013-07-16 13:20:11 +0900 (991dce7) +++ test/command/test-column-create.rb 2013-07-16 13:24:03 +0900 (46dbadb) @@ -61,6 +61,23 @@ class ColumnCreateCommandTest < Test::Unit::TestCase command = parse({}) assert_equal([], command.flags) end + + class PredicateTest < self + data({ + "COLUMN_SCALAR" => { + :expected => true, + :flags => "COLUMN_SCALAR", + }, + "other flag" => { + :expected => false, + :flags => "COLUMN_VECTOR", + } + }) + def test_column_scalar?(data) + command = parse({"flags" => data[:flags]}) + assert_equal(data[:expected], command.column_scalar?) + end + end end end end -------------- next part -------------- HTML����������������������������...Download