[Groonga-commit] groonga/groonga-command at 8f8bf18 [master] table_remove: support recursive parameter

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Mar 15 23:56:35 JST 2016


Kouhei Sutou	2016-03-15 23:56:35 +0900 (Tue, 15 Mar 2016)

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

  Message:
    table_remove: support recursive parameter

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

  Modified: lib/groonga/command/table-remove.rb (+8 -0)
===================================================================
--- lib/groonga/command/table-remove.rb    2016-03-15 23:56:07 +0900 (01aa2e2)
+++ lib/groonga/command/table-remove.rb    2016-03-15 23:56:35 +0900 (1bf5f96)
@@ -25,6 +25,7 @@ module Groonga
         def parameter_names
           [
             :name,
+            :recursive,
           ]
         end
       end
@@ -35,6 +36,13 @@ module Groonga
       def name
         self[:name]
       end
+
+      # @return [Boolean] `recursive` parameter value.
+      #
+      # @since 1.1.8
+      def recursive?
+        self[:recursive] != "no"
+      end
     end
   end
 end

  Modified: test/command/test-table-remove.rb (+21 -1)
===================================================================
--- test/command/test-table-remove.rb    2016-03-15 23:56:07 +0900 (55cc367)
+++ test/command/test-table-remove.rb    2016-03-15 23:56:35 +0900 (8efa104)
@@ -25,10 +25,12 @@ class TableRemoveCommandTest < Test::Unit::TestCase
   class ConstructorTest < self
     def test_ordered_arguments
       name = "Users"
+      recursive = "yes"
 
-      command = table_remove_command({}, [name])
+      command = table_remove_command({}, [name, recursive])
       assert_equal({
                      :name => name,
+                     :recursive => recursive,
                    },
                    command.arguments)
     end
@@ -40,4 +42,22 @@ class TableRemoveCommandTest < Test::Unit::TestCase
       assert_equal("Users", command.name)
     end
   end
+
+  class RecursiveTest < self
+    class ReaderTest < self
+      def test_default
+        command = table_remove_command
+        assert do
+          command.recursive?
+        end
+      end
+
+      def test_no
+        command = table_remove_command(:recursive => "no")
+        assert do
+          not command.recursive?
+        end
+      end
+    end
+  end
 end
-------------- next part --------------
HTML����������������������������...
Descargar 



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