[Groonga-commit] droonga/drntest at cfba6b0 [master] Report error for invalid JSONs

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Nov 27 16:26:32 JST 2013


YUKI Hiroshi	2013-11-27 16:26:32 +0900 (Wed, 27 Nov 2013)

  New Revision: cfba6b096f6ea27947f33ea8bdc61b4c3029f750
  https://github.com/droonga/drntest/commit/cfba6b096f6ea27947f33ea8bdc61b4c3029f750

  Message:
    Report error for invalid JSONs

  Modified files:
    lib/drntest/test-runner.rb

  Modified: lib/drntest/test-runner.rb (+19 -4)
===================================================================
--- lib/drntest/test-runner.rb    2013-11-27 16:25:03 +0900 (05e4206)
+++ lib/drntest/test-runner.rb    2013-11-27 16:26:32 +0900 (5494283)
@@ -258,18 +258,33 @@ module Drntest
       puts "Saving received results as #{output_path}"
       File.open(output_path, "w") do |file|
         results.each do |result|
-          json = JSON.pretty_generate(result)
-          file.puts(json)
+          begin
+            json = JSON.pretty_generate(result)
+            file.puts(json)
+          rescue JSON::GeneratorError => error
+            p error
+            p result
+          end
         end
       end
     end
 
     def show_diff(expecteds, actuals)
       expected_pretty = expecteds.collect do |expected|
-        JSON.pretty_generate(expected)
+        begin
+          JSON.pretty_generate(expected)
+        rescue JSON::GeneratorError => error
+          p error
+          p expected
+        end
       end.join("\n")
       actual_pretty = actuals.collect do |actual|
-        JSON.pretty_generate(actual)
+        begin
+          JSON.pretty_generate(actual)
+        rescue JSON::GeneratorError => error
+          p error
+          p actual
+        end
       end.join("\n")
 
       create_temporary_file("expected", expected_pretty) do |expected_file|
-------------- next part --------------
HTML����������������������������...
Download 



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