[Groonga-commit] groonga/groonga [master] follow JSON output format change.

Back to archive index

null+****@clear***** null+****@clear*****
2010年 7月 14日 (水) 17:10:53 JST


Kouhei Sutou	2010-07-14 08:10:53 +0000 (Wed, 14 Jul 2010)

  New Revision: ea7e7400fb971c4eaea5af8ea7ea02acecc92b28

  Log:
    follow JSON output format change.

  Modified files:
    test/unit/command/test-config-file.rb
    test/unit/lib/ruby/groonga-local-gqtp-test-utils.rb
    test/unit/lib/ruby/groonga-test-utils.rb

  Modified: test/unit/command/test-config-file.rb (+2 -1)
===================================================================
--- test/unit/command/test-config-file.rb    2010-07-14 08:07:37 +0000 (bc28914)
+++ test/unit/command/test-config-file.rb    2010-07-14 08:10:53 +0000 (3ab6b44)
@@ -33,6 +33,7 @@ class ConfigFileTest < Test::Unit::TestCase
 
   def test_config_empty
     open(@config_path, "w") {|f|}
-    assert_equal("[true]\n", run_groonga("-n", @database_path, "quit"))
+    assert_equal("[[0,0.0,0.0],true]\n",
+                 run_groonga("-n", @database_path, "quit"))
   end
 end

  Modified: test/unit/lib/ruby/groonga-local-gqtp-test-utils.rb (+1 -1)
===================================================================
--- test/unit/lib/ruby/groonga-local-gqtp-test-utils.rb    2010-07-14 08:07:37 +0000 (3d7bffe)
+++ test/unit/lib/ruby/groonga-local-gqtp-test-utils.rb    2010-07-14 08:10:53 +0000 (55797ce)
@@ -56,7 +56,7 @@ module GroongaLocalGQTPTestUtils
             "commands:\n>>>\n#{commands}\n<<<\n" +
             "output:\n>>>\n#{output}\n<<<\n")
     end
-    output.gsub(/^\[\[0,[\d\.e\-]+,[\d\.e\-]+\]/, "[[0,0.0,0.0]")
+    normalize_json_result(output)
   end
 
   def assert_dump(expected, commands)

  Modified: test/unit/lib/ruby/groonga-test-utils.rb (+5 -1)
===================================================================
--- test/unit/lib/ruby/groonga-test-utils.rb    2010-07-14 08:07:37 +0000 (e5aedab)
+++ test/unit/lib/ruby/groonga-test-utils.rb    2010-07-14 08:10:53 +0000 (a5c8d7f)
@@ -131,7 +131,11 @@ module GroongaTestUtils
   end
 
   def run_groonga(*arguments)
-    `#{construct_command_line(*arguments)}`
+    normalize_json_result(`#{construct_command_line(*arguments)}`)
+  end
+
+  def normalize_json_result(result)
+    result.gsub(/^\[\[0,[\d\.e\-]+,[\d\.e\-]+\]/, "[[0,0.0,0.0]")
   end
 
   def utf8(string)




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