[Groonga-commit] groonga/grntest [master] Use Groonga::Command::Parser to convert a groonga command to URL

Back to archive index

Haruka Yoshihara null+****@clear*****
Mon Nov 26 18:37:35 JST 2012


Haruka Yoshihara	2012-11-26 18:37:35 +0900 (Mon, 26 Nov 2012)

  New Revision: ef4ed6e46edda859c82763bc4a42aa89db57069c
  https://github.com/groonga/grntest/commit/ef4ed6e46edda859c82763bc4a42aa89db57069c

  Log:
    Use Groonga::Command::Parser to convert a groonga command to URL

  Modified files:
    lib/grntest/tester.rb
    test/test-executor.rb

  Modified: lib/grntest/tester.rb (+4 -5)
===================================================================
--- lib/grntest/tester.rb    2012-11-26 18:08:23 +0900 (89900c0)
+++ lib/grntest/tester.rb    2012-11-26 18:37:35 +0900 (208347e)
@@ -1683,15 +1683,14 @@ EOF
         load_values = ""
         @gqtp_command.each_line.with_index do |line, i|
           if i.zero?
-            command, *arguments = Shellwords.split(line)
+            command = Groonga::Command::Parser.parse(line)
           else
             load_values << line
           end
         end
-        arguments.concat(["--values", load_values]) unless load_values.empty?
-
-        named_arguments = convert_to_named_arguments(command, arguments)
-        build_url(command, named_arguments)
+        url = command.to_uri_format
+        url << "&values=#{CGI.escape(load_values)}" unless load_values.empty?
+        url
       end
 
       private

  Modified: test/test-executor.rb (+5 -1)
===================================================================
--- test/test-executor.rb    2012-11-26 18:08:23 +0900 (58e80d7)
+++ test/test-executor.rb    2012-11-26 18:37:35 +0900 (2e9e69d)
@@ -186,7 +186,11 @@ EOF
     def build_url(command, named_arguments)
       url = "/d/#{command}"
       query_parameters = []
-      named_arguments.each do |name, argument|
+
+      sorted_arguments = named_arguments.sort_by do |name, _|
+        name
+      end
+      sorted_arguments.each do |name, argument|
         query_parameters << "#{CGI.escape(name)}=#{CGI.escape(argument)}"
       end
       unless query_parameters.empty?
-------------- next part --------------
HTML����������������������������...
Download 



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