use test/unit so we can add more features more easily
Chris Wanstrath chris@ozmm.org
Mon, 02 Nov 2009 17:15:34 -0800
1 files changed,
11 insertions(+),
16 deletions(-)
jump to
M
test/markup_test.rb
→
test/markup_test.rb
@@ -1,28 +1,23 @@
$LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib" require 'github/markup' +require 'test/unit' -def test_markup - passed = true +class MarkupTest < Test::Unit::TestCase Dir['test/markups/README.*'].each do |readme| next if readme =~ /html$/ markup = readme.split('.').last - expected = File.read("#{readme}.html") - actual = GitHub::Markup.render(readme, File.read(readme)) + define_method "test_#{markup}" do + 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 + assert expected == actual, <<-message +#{markup} expected: +#{expected} +#{markup} actual: +#{actual} +message end end - passed -end - -at_exit do - exit test_markup ? 0 : 1 end