Yoji Shidara
null+****@clear*****
Thu Sep 19 12:40:28 JST 2013
Yoji Shidara 2013-09-19 12:40:28 +0900 (Thu, 19 Sep 2013) New Revision: 1f5b9359fe2dbb809c85658eddebd27d68b26ec7 https://github.com/droonga/drntest/commit/1f5b9359fe2dbb809c85658eddebd27d68b26ec7 Message: Extract output_reject_file and output_actual_file Modified files: lib/drntest/test-runner.rb Modified: lib/drntest/test-runner.rb (+17 -6) =================================================================== --- lib/drntest/test-runner.rb 2013-09-19 12:23:07 +0900 (3f0553a) +++ lib/drntest/test-runner.rb 2013-09-19 12:40:28 +0900 (0a01d19) @@ -29,17 +29,28 @@ module Drntest else puts "FAIL" show_diff(expected, actual) - reject_path = target_path.sub_ext(".reject") - puts "Saving received result as #{reject_path}" - File.write(reject_path, actual_json) + output_reject_file(actual) end else - actual_path = target_path.sub_ext(".actual") - puts "No expectation specified. Saving result as #{actual_path}." - File.write(actual_path, actual_json) + output_actual_file(actual) end end + def output_reject_file(actual_result) + output_actual_result(actual_result, ".reject") + end + + def output_actual_file(actual_result) + output_actual_result(actual_result, ".actual") + end + + def output_actual_result(actual_result, suffix) + output_path = target_path.sub_ext(suffix) + puts "Saving received result as #{output_path}" + actual_json = actual_result.to_json + File.write(output_path, actual_json) + end + def show_diff(expected, actual) expected_pretty = expected.pretty_inspect actual_pretty = actual.pretty_inspect -------------- next part -------------- HTML����������������������������...Download