From d9d447e4d8c09943dc7832cdc921be7f2039471e Mon Sep 17 00:00:00 2001 From: murphy Date: Mon, 20 Apr 2009 21:14:35 +0000 Subject: Fixed some test suite problems. * coderay_suite: UTF-8 output is compared as binary. * functional tests: cleaned up. * test/unit: prevent Ruby 1.9 warning about circular require. --- test/scanners/coderay_suite.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'test/scanners/coderay_suite.rb') diff --git a/test/scanners/coderay_suite.rb b/test/scanners/coderay_suite.rb index 6e6249b..5edf6be 100644 --- a/test/scanners/coderay_suite.rb +++ b/test/scanners/coderay_suite.rb @@ -297,9 +297,16 @@ module CodeRay if File.exist?(expected_filename) && !(ENV['lang'] && ENV['new'] && name == ENV['new']) expected = File.open(expected_filename, 'rb') { |f| break f.read } + if result.respond_to?(:bytesize) && result.bytesize != result.size + # for char, i in result.chars.with_index + # raise "result has non-ASCII-8BIT character in line #{result[0,i].count(?\n) + 1}" if char.bytesize != 1 + # end + # UTF-8 encoded result; comparison needs to be done on binary level + result.force_encoding(:binary) + end ok = expected == result - actual_filename = expected_filename.sub('.expected.', '.actual.') unless ok + actual_filename = expected_filename.sub('.expected.', '.actual.') File.open(actual_filename, 'wb') { |f| f.write result } diff = expected_filename.sub(/\.expected\..*/, '.debug.diff') system "diff --unified=0 --text #{expected_filename} #{actual_filename} > #{diff}" -- cgit v1.2.1