custom test runner
Chris Wanstrath chris@ozmm.org
Sat, 31 Oct 2009 17:04:01 -0700
1 files changed,
17 insertions(+),
7 deletions(-)
jump to
M
test/markup_test.rb
→
test/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