Skip to content

Commit

Permalink
use diff(1) for showing test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Mar 25, 2010
1 parent f011186 commit bf7155e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions test/markup_test.rb
Expand Up @@ -9,14 +9,19 @@ class MarkupTest < Test::Unit::TestCase
markup = readme.split('/').last.gsub(/^README\./, '')

define_method "test_#{markup}" do
expected = File.read("#{readme}.html")
expected_file = "#{readme}.html"
expected = File.read(expected_file)
actual = GitHub::Markup.render(readme, File.read(readme))

assert expected == actual, <<-message
#{markup} expected:
#{expected}
#{markup} actual:
#{actual}
diff = IO.popen("diff -u - #{expected_file}", 'r+') do |f|
f.write actual
f.close_write
f.read
end

assert expected == actual, <<message
#{File.basename expected_file}'s contents don't match command output:
#{diff}
message
end
end
Expand Down

0 comments on commit bf7155e

Please sign in to comment.