[Groonga-commit] groonga/grntest [master] Support one-line load command

Back to archive index

null+****@clear***** null+****@clear*****
2012年 7月 17日 (火) 23:47:04 JST


Kouhei Sutou	2012-07-17 23:47:04 +0900 (Tue, 17 Jul 2012)

  New Revision: 57986c394c177d0304375d58e0fbf80cb8cb6d30
  https://github.com/groonga/grntest/commit/57986c394c177d0304375d58e0fbf80cb8cb6d30

  Log:
    Support one-line load command

  Modified files:
    lib/groonga/tester.rb

  Modified: lib/groonga/tester.rb (+8 -4)
===================================================================
--- lib/groonga/tester.rb    2012-07-17 23:46:52 +0900 (861a7fb)
+++ lib/groonga/tester.rb    2012-07-17 23:47:04 +0900 (5a424d3)
@@ -796,7 +796,7 @@ EOF
       def execute_command_line(command_line)
         extract_command_info(command_line)
         log_input(command_line)
-        if @current_command == "load"
+        if multiline_load_command?
           @loading = true
           @pending_load_command = command_line.dup
         else
@@ -805,13 +805,12 @@ EOF
       end
 
       def extract_command_info(command_line)
-        words = Shellwords.split(command_line)
-        @current_command = words.shift
+        @current_command, *@current_arguments = Shellwords.split(command_line)
         if @current_command == "dump"
           @output_format = "groonga-command"
         else
           @output_format = "json"
-          words.each_with_index do |word, i|
+          @current_arguments.each_with_index do |word, i|
             if /\A--output_format(?:=(.+))?\z/ =~ word
               @output_format = $1 || words[i + 1]
               break
@@ -820,6 +819,11 @@ EOF
         end
       end
 
+      def multiline_load_command?
+        @current_command == "load" and
+          not @current_arguments.include?("--values")
+      end
+
       def execute_command(command)
         log_output(send_command(command))
         log_error(read_error_log)
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
下载 



Groonga-commit メーリングリストの案内
Back to archive index