[Groonga-commit] droonga/drntest at b935e20 [master] Extract common format code

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Dec 10 19:08:53 JST 2013


Kouhei Sutou	2013-12-10 19:08:53 +0900 (Tue, 10 Dec 2013)

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

  Message:
    Extract common format code

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

  Modified: lib/drntest/test-runner.rb (+13 -16)
===================================================================
--- lib/drntest/test-runner.rb    2013-12-10 19:04:56 +0900 (840759a)
+++ lib/drntest/test-runner.rb    2013-12-10 19:08:53 +0900 (a8e2b6e)
@@ -211,22 +211,8 @@ module Drntest
     end
 
     def show_diff(expecteds, actuals)
-      expected_pretty = expecteds.collect do |expected|
-        begin
-          JSON.pretty_generate(expected)
-        rescue JSON::GeneratorError => error
-          p error
-          p expected
-        end
-      end.join("\n")
-      actual_pretty = actuals.collect do |actual|
-        begin
-          JSON.pretty_generate(actual)
-        rescue JSON::GeneratorError => error
-          p error
-          p actual
-        end
-      end.join("\n")
+      expected_pretty = format_results(expecteds)
+      actual_pretty = format_results(actuals)
 
       create_temporary_file("expected", expected_pretty) do |expected_file|
         create_temporary_file("actual", actual_pretty) do |actual_file|
@@ -240,6 +226,17 @@ module Drntest
       end
     end
 
+    def format_results(results)
+      results.collect do |result|
+        begin
+          JSON.pretty_generate(result)
+        rescue JSON::GeneratorError => error
+          p error
+          p result
+        end
+      end.join("\n")
+    end
+
     def create_temporary_file(key, content)
       file = Tempfile.new("drntest-#{key}")
       file.write(content)
-------------- next part --------------
HTML����������������������������...
Download 



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