Kouhei Sutou
null+****@clear*****
Wed Jan 13 17:34:32 JST 2016
Kouhei Sutou 2015-07-28 10:55:51 +0900 (Tue, 28 Jul 2015) New Revision: 5b92523b6d5080b653a878f30cf492e42a207f4e https://github.com/groonga/groonga-command/commit/5b92523b6d5080b653a878f30cf492e42a207f4e Message: Support log_level Added files: lib/groonga/command/log-level.rb test/command/test-log-level.rb Modified files: lib/groonga/command.rb Modified: lib/groonga/command.rb (+1 -0) =================================================================== --- lib/groonga/command.rb 2015-07-28 10:50:52 +0900 (d54d46f) +++ lib/groonga/command.rb 2015-07-28 10:55:51 +0900 (60527f9) @@ -33,6 +33,7 @@ require "groonga/command/logical-count" require "groonga/command/logical-range-filter" require "groonga/command/logical-select" require "groonga/command/logical-table-remove" +require "groonga/command/log-level" require "groonga/command/log-put" require "groonga/command/normalize" require "groonga/command/object-exist" Added: lib/groonga/command/log-level.rb (+43 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/log-level.rb 2015-07-28 10:55:51 +0900 (65ba120) @@ -0,0 +1,43 @@ +# Copyright (C) 2015 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +require "groonga/command/base" + +module Groonga + module Command + # A command class that represents `log_level` command. + # + # @since 1.1.3 + class LogLevel < Base + Command.register("log_level", self) + + class << self + def parameter_names + [ + :level, + ] + end + end + + # @return [String] `level` parameter value. + # + # @since 1.1.3 + def level + self[:level] + end + end + end +end Added: test/command/test-log-level.rb (+46 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-log-level.rb 2015-07-28 10:55:51 +0900 (6023ebd) @@ -0,0 +1,46 @@ +# Copyright (C) 2015 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +class LogLevelCommandTest < Test::Unit::TestCase + private + def log_level_command(pair_arguments={}, ordered_arguments=[]) + Groonga::Command::LogLevel.new("log_level", + pair_arguments, + ordered_arguments) + end + + class ConstructorTest < self + def test_ordered_arguments + level = "debug" + + ordered_arguments = [ + level, + ] + command = log_level_command({}, ordered_arguments) + assert_equal({ + :level => level, + }, + command.arguments) + end + end + + class LevelTest < self + def test_reader + command = log_level_command(:level => "debug") + assert_equal("debug", command.level) + end + end +end -------------- next part -------------- HTML����������������������������...Download