Kouhei Sutou
null+****@clear*****
Wed Mar 11 12:25:41 JST 2015
Kouhei Sutou 2015-03-11 12:25:41 +0900 (Wed, 11 Mar 2015) New Revision: e028cd3fe1a61a70f4aac9062360d557ec8f2afb https://github.com/groonga/groonga-command/commit/e028cd3fe1a61a70f4aac9062360d557ec8f2afb Message: Support plugin_register It's not implemented in Groonga yet but it'll be implemented. Added files: lib/groonga/command/plugin-register.rb test/command/test-plugin-register.rb Modified files: lib/groonga/command.rb Modified: lib/groonga/command.rb (+1 -0) =================================================================== --- lib/groonga/command.rb 2015-03-11 12:17:08 +0900 (6121a56) +++ lib/groonga/command.rb 2015-03-11 12:25:41 +0900 (88a547c) @@ -31,6 +31,7 @@ require "groonga/command/load" require "groonga/command/logical-count" require "groonga/command/logical-range-filter" require "groonga/command/normalize" +require "groonga/command/plugin-register" require "groonga/command/plugin-unregister" require "groonga/command/range-filter" require "groonga/command/register" Added: lib/groonga/command/plugin-register.rb (+43 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/plugin-register.rb 2015-03-11 12:25:41 +0900 (d2f9afc) @@ -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 `plugin_register` command. + # + # @since 1.1.2 + class PluginRegister < Base + Command.register("plugin_register", self) + + class << self + def parameter_names + [ + :name, + ] + end + end + + # @return [String] `name` parameter value. + # + # @since 1.1.2 + def name + self[:name] + end + end + end +end Added: test/command/test-plugin-register.rb (+46 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-plugin-register.rb 2015-03-11 12:25:41 +0900 (1994c80) @@ -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 PluginRegisterCommandTest < Test::Unit::TestCase + private + def plugin_register_command(pair_arguments={}, ordered_arguments=[]) + Groonga::Command::PluginRegister.new("plugin_register", + pair_arguments, + ordered_arguments) + end + + class ConstructorTest < self + def test_ordered_arguments + name = "query_expanders/tsv" + + ordered_arguments = [ + name, + ] + command = plugin_register_command({}, ordered_arguments) + assert_equal({ + :name => name, + }, + command.arguments) + end + end + + class NameTest < self + def test_reader + command = plugin_register_command(:name => "query_expanders/tsv") + assert_equal("query_expanders/tsv", command.name) + end + end +end -------------- next part -------------- HTML����������������������������... 下載