[Groonga-commit] groonga/groonga-command at ac5c5d7 [master] column_create: Parse flags with "|"

Back to archive index

Kosuke Asami null+****@clear*****
Tue Jul 16 13:20:11 JST 2013


Kosuke Asami	2013-07-16 13:20:11 +0900 (Tue, 16 Jul 2013)

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

  Message:
    column_create: Parse flags with "|"

  Modified files:
    lib/groonga/command/column-create.rb
    test/command/test-column-create.rb

  Modified: lib/groonga/command/column-create.rb (+4 -0)
===================================================================
--- lib/groonga/command/column-create.rb    2013-07-16 13:19:30 +0900 (ee58c93)
+++ lib/groonga/command/column-create.rb    2013-07-16 13:20:11 +0900 (cf66d9f)
@@ -34,6 +34,10 @@ module Groonga
           ]
         end
       end
+
+      def flags
+        @flags ||= (self[:flags] || "").split(/\s*\|\s*/)
+      end
     end
   end
 end

  Modified: test/command/test-column-create.rb (+19 -0)
===================================================================
--- test/command/test-column-create.rb    2013-07-16 13:19:30 +0900 (a4d5ea1)
+++ test/command/test-column-create.rb    2013-07-16 13:20:11 +0900 (991dce7)
@@ -43,5 +43,24 @@ class ColumnCreateCommandTest < Test::Unit::TestCase
     def parse(arguments)
       super("column_create", arguments, :output_type => false)
     end
+
+    class FlagsTest < self
+      def test_multiple
+        command = parse({"flags" => "COLUMN_INDEX|WITH_POSITION"})
+        assert_equal(["COLUMN_INDEX", "WITH_POSITION"],
+                     command.flags)
+      end
+
+      def test_one
+        command = parse({"flags" => "COLUMN_VECTOR"})
+        assert_equal(["COLUMN_VECTOR"],
+                     command.flags)
+      end
+
+      def test_no_flags
+        command = parse({})
+        assert_equal([], command.flags)
+      end
+    end
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



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