Kouhei Sutou
null+****@clear*****
Tue Dec 6 16:07:01 JST 2016
Kouhei Sutou 2016-12-06 16:07:01 +0900 (Tue, 06 Dec 2016) New Revision: 480e5f87fe83976663fb1b10bb601e545286ede6 https://github.com/groonga/groonga-command/commit/480e5f87fe83976663fb1b10bb601e545286ede6 Message: load: support --output_ids Modified files: lib/groonga/command/load.rb test/command/test-load.rb Modified: lib/groonga/command/load.rb (+8 -0) =================================================================== --- lib/groonga/command/load.rb 2016-10-11 17:59:08 +0900 (50c5ab6) +++ lib/groonga/command/load.rb 2016-12-06 16:07:01 +0900 (abf5685) @@ -36,6 +36,7 @@ module Groonga :ifexists, :input_type, :each, + :output_ids, ] end end @@ -58,6 +59,13 @@ module Groonga @columns ||= parse_columns(self[:columns]) end + # @return [Boolean] `true` if `output_ids` value is `"yes"`. + # + # @since 1.3.0 + def output_ids? + self[:output_ids] == "yes" + end + private def parse_values(values) return values if values.nil? Modified: test/command/test-load.rb (+19 -0) =================================================================== --- test/command/test-load.rb 2016-10-11 17:59:08 +0900 (fdf10e7) +++ test/command/test-load.rb 2016-12-06 16:07:01 +0900 (ae820bc) @@ -31,6 +31,7 @@ class LoadCommandTest < Test::Unit::TestCase ifexists = "_key == \"Alice\"" input_type = "json" each = "strlen(_key)" + output_ids = "no" ordered_arguments = [ values, @@ -39,6 +40,7 @@ class LoadCommandTest < Test::Unit::TestCase ifexists, input_type, each, + output_ids, ] command = load_command({}, ordered_arguments) assert_equal({ @@ -48,6 +50,7 @@ class LoadCommandTest < Test::Unit::TestCase :ifexists => ifexists, :input_type => input_type, :each => each, + :output_ids => output_ids, }, command.arguments) end @@ -87,4 +90,20 @@ class LoadCommandTest < Test::Unit::TestCase }) end end + + class OutputIDsTest < self + def test_specified + command = load_command({"output_ids" => "yes"}) + assert do + command.output_ids? + end + end + + def test_omitted + command = load_command + assert do + not command.output_ids? + end + end + end end -------------- next part -------------- HTML����������������������������...Download