Kouhei Sutou
null+****@clear*****
Fri Jul 24 16:19:44 JST 2015
Kouhei Sutou 2015-07-24 16:19:44 +0900 (Fri, 24 Jul 2015) New Revision: 8dfea6260b77528004e4a886ee679e4f35e6f4c0 https://github.com/groonga/groonga-command/commit/8dfea6260b77528004e4a886ee679e4f35e6f4c0 Message: Support exist Added files: lib/groonga/command/exist.rb test/command/test-exist.rb Modified files: lib/groonga/command.rb Modified: lib/groonga/command.rb (+1 -0) =================================================================== --- lib/groonga/command.rb 2015-07-24 15:45:29 +0900 (dad51d7) +++ lib/groonga/command.rb 2015-07-24 16:19:44 +0900 (ec3b70e) @@ -26,6 +26,7 @@ require "groonga/command/column-remove" require "groonga/command/column-rename" require "groonga/command/delete" require "groonga/command/dump" +require "groonga/command/exist" require "groonga/command/get" require "groonga/command/io-flush" require "groonga/command/load" Added: lib/groonga/command/exist.rb (+43 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga/command/exist.rb 2015-07-24 16:19:44 +0900 (0232677) @@ -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 `exist` command. + # + # @since 1.1.3 + class Exist < Base + Command.register("exist", self) + + class << self + def parameter_names + [ + :name, + ] + end + end + + # @return [String] `name` parameter value. + # + # @since 1.1.3 + def name + self[:name] + end + end + end +end Added: test/command/test-exist.rb (+43 -0) 100644 =================================================================== --- /dev/null +++ test/command/test-exist.rb 2015-07-24 16:19:44 +0900 (fa698d2) @@ -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 + +class ExistCommandTest < Test::Unit::TestCase + private + def exist_command(pair_arguments={}, ordered_arguments=[]) + Groonga::Command::Exist.new("exist", + pair_arguments, + ordered_arguments) + end + + class ConstructorTest < self + def test_ordered_arguments + name = "Users" + + command = exist_command({}, [name]) + assert_equal({ + :name => name, + }, + command.arguments) + end + end + + class NameTest < self + def test_reader + command = exist_command(:name => "Users") + assert_equal("Users", command.name) + end + end +end -------------- next part -------------- HTML����������������������������...下載