[Groonga-commit] groonga/groonga-command at dc693cd [master] Support object_remove

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Feb 9 11:10:29 JST 2016


Kouhei Sutou	2016-02-09 11:10:29 +0900 (Tue, 09 Feb 2016)

  New Revision: dc693cd22de2bc9d4b15ec583091915fbbabdeed
  https://github.com/groonga/groonga-command/commit/dc693cd22de2bc9d4b15ec583091915fbbabdeed

  Message:
    Support object_remove

  Added files:
    test/command/test-object-remove.rb
  Modified files:
    lib/groonga/command.rb
    lib/groonga/command/object-remove.rb

  Modified: lib/groonga/command.rb (+1 -0)
===================================================================
--- lib/groonga/command.rb    2016-02-08 18:08:55 +0900 (5195421)
+++ lib/groonga/command.rb    2016-02-09 11:10:29 +0900 (108de77)
@@ -43,6 +43,7 @@ require "groonga/command/log-level"
 require "groonga/command/log-put"
 require "groonga/command/normalize"
 require "groonga/command/object-exist"
+require "groonga/command/object-remove"
 require "groonga/command/plugin-register"
 require "groonga/command/plugin-unregister"
 require "groonga/command/range-filter"

  Modified: lib/groonga/command/object-remove.rb (+2 -2)
===================================================================
--- lib/groonga/command/object-remove.rb    2016-02-08 18:08:55 +0900 (1082e19)
+++ lib/groonga/command/object-remove.rb    2016-02-09 11:10:29 +0900 (e6cc8f6)
@@ -43,8 +43,8 @@ module Groonga
       # @return [Boolean] `force` parameter value.
       #
       # @since 1.1.7
-      def force
-        self[:force] != "yes"
+      def force?
+        self[:force] == "yes"
       end
     end
   end

  Added: test/command/test-object-remove.rb (+52 -0) 100644
===================================================================
--- /dev/null
+++ test/command/test-object-remove.rb    2016-02-09 11:10:29 +0900 (4229abc)
@@ -0,0 +1,52 @@
+# Copyright (C) 2016  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 ObjectRemoveCommandTest < Test::Unit::TestCase
+  private
+  def object_remove_command(pair_arguments={}, ordered_arguments=[])
+    Groonga::Command::ObjectRemove.new("object_remove",
+                                       pair_arguments,
+                                       ordered_arguments)
+  end
+
+  class ConstructorTest < self
+    def test_ordered_arguments
+      name = "Users"
+      force = "yes"
+
+      command = object_remove_command({}, [name, force])
+      assert_equal({
+                     :name  => name,
+                     :force => force,
+                   },
+                   command.arguments)
+    end
+  end
+
+  class NameTest < self
+    def test_reader
+      command = object_remove_command(:name => "Users")
+      assert_equal("Users", command.name)
+    end
+  end
+
+  class ForceTest < self
+    def test_reader
+      command = object_remove_command(:force => "yes")
+      assert_true(command.force?)
+    end
+  end
+end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index