all repos — markup @ 0ddd5f979bccbad6ccf690788e17854a04e7cf75

The code we use to render README.your_favorite_markup

custom test runner
Chris Wanstrath chris@ozmm.org
Sat, 31 Oct 2009 17:04:01 -0700
commit

0ddd5f979bccbad6ccf690788e17854a04e7cf75

parent

cafa5abd8d60541389671eb5609654e37c407e2e

1 files changed, 17 insertions(+), 7 deletions(-)

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

@@ -1,18 +1,28 @@

$LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib" -$LOAD_PATH.unshift File.dirname(__FILE__) require 'github/markup' -require 'test/unit' -class MarkupTest < Test::Unit::TestCase +def test_markup + passed = true Dir['test/markups/README.*'].each do |readme| next if readme =~ /html$/ markup = readme.split('.').last - define_method "test_#{markup}" do - expected = File.read("#{readme}.html") - actual = GitHub::Markup.render(readme, File.read(readme)) - assert_equal expected, actual + expected = File.read("#{readme}.html") + actual = GitHub::Markup.render(readme, File.read(readme)) + + if expected == actual + puts "- #{markup}: OK" + else + passed = false + puts "- #{markup}: FAIL" + puts "#{markup} expected:", expected + puts "#{markup} actual:", actual end end + passed +end + +at_exit do + exit test_markup ? 0 : 1 end