[Groonga-commit] groonga/groonga-query-log at a30ba7b [master] Support one element case

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Sep 9 17:37:52 JST 2014


Kouhei Sutou	2014-09-09 17:37:52 +0900 (Tue, 09 Sep 2014)

  New Revision: a30ba7bb9ad310dfac13dc56b901e4618941523d
  https://github.com/groonga/groonga-query-log/commit/a30ba7bb9ad310dfac13dc56b901e4618941523d

  Message:
    Support one element case

  Modified files:
    lib/groonga/query-log/incompatibility-detector.rb
    test/test-incompatibility-detector.rb

  Modified: lib/groonga/query-log/incompatibility-detector.rb (+7 -1)
===================================================================
--- lib/groonga/query-log/incompatibility-detector.rb    2014-09-09 17:04:14 +0900 (27da756)
+++ lib/groonga/query-log/incompatibility-detector.rb    2014-09-09 17:37:52 +0900 (9c2048d)
@@ -78,12 +78,18 @@ module Groonga
         def space_delimiter?(string)
           return false if string.nil?
           return false if have_function_call?(string)
-          string.split(/\s+/) != string.split(/\s*,\s*/)
+          return false if have_comma?(string)
+
+          string.strip.split(/\s+/).size > 1
         end
 
         def have_function_call?(string)
           string.include?("(")
         end
+
+        def have_comma?(string)
+          string.include?(",")
+        end
       end
     end
   end

  Modified: test/test-incompatibility-detector.rb (+8 -0)
===================================================================
--- test/test-incompatibility-detector.rb    2014-09-09 17:04:14 +0900 (212e82e)
+++ test/test-incompatibility-detector.rb    2014-09-09 17:37:52 +0900 (66ea8aa)
@@ -51,6 +51,14 @@ class IncompatibilityDetectorTest < Test::Unit::TestCase
             "select: output_columns: space is used as delimiter: <_id _key>"
           assert_equal([message], detect("select --output_columns '_id _key'"))
         end
+
+        def test_comma_delimiter
+          assert_equal([], detect("select --output_columns '_id, _key'"))
+        end
+
+        def test_one_element
+          assert_equal([], detect("select --output_columns '_id'"))
+        end
       end
     end
   end
-------------- next part --------------
HTML����������������������������...
Download 



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