all repos — markup @ bf7155e8ccd681171681e8b467f8836bc6e86c7a

The code we use to render README.your_favorite_markup

use diff(1) for showing test failures
Chris Wanstrath chris@ozmm.org
Thu, 25 Mar 2010 13:02:44 -0700
commit

bf7155e8ccd681171681e8b467f8836bc6e86c7a

parent

f0111861dcf5926e1b1042319c015342ea8afd5f

1 files changed, 11 insertions(+), 6 deletions(-)

jump to
M test/markup_test.rbtest/markup_test.rb

@@ -9,14 +9,19 @@ next if readme =~ /html$/

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