[Groonga-commit] groonga/groonga-command-parser at 8f0a6f3 [master] Ignore "/" only path

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Sep 10 11:11:14 JST 2016


Kouhei Sutou	2016-09-10 11:11:14 +0900 (Sat, 10 Sep 2016)

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

  Message:
    Ignore "/" only path

  Modified files:
    lib/groonga/command/parser.rb
    test/test-parser.rb

  Modified: lib/groonga/command/parser.rb (+5 -0)
===================================================================
--- lib/groonga/command/parser.rb    2016-09-10 11:06:46 +0900 (2edfcfc)
+++ lib/groonga/command/parser.rb    2016-09-10 11:11:14 +0900 (07416b1)
@@ -248,6 +248,8 @@ module Groonga
           on_comment($POSTMATCH)
         else
           @command = parse_command(line)
+          return if****@comma*****?
+
           @command.original_source = line
           process_command
         end
@@ -302,6 +304,9 @@ module Groonga
           prefix = ""
           name = path
         end
+
+        return nil if name.empty?
+
         name, output_type = name.split(/\./, 2)
         arguments["output_type"] = output_type if output_type
         command_class = ::Groonga::Command.find(name)

  Modified: test/test-parser.rb (+7 -0)
===================================================================
--- test/test-parser.rb    2016-09-10 11:06:46 +0900 (1ed60fa)
+++ test/test-parser.rb    2016-09-10 11:11:14 +0900 (9da0693)
@@ -81,6 +81,13 @@ class ParserTest < Test::Unit::TestCase
       assert_equal("/groonga/db1", command.path_prefix)
     end
 
+    def test_no_command_name
+      error = Groonga::Command::Parser::Error.new("not completed", "/", "")
+      assert_raise(error) do
+        Groonga::Command::Parser.parse("/")
+      end
+    end
+
     class ParseTest < self
       include ParseTests
     end
-------------- next part --------------
HTML����������������������������...
下載 



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