all repos — markup @ 122b433bb1ad4cf50896186944ed0820e8041303

The code we use to render README.your_favorite_markup

use test/unit so we can add more features more easily
Chris Wanstrath chris@ozmm.org
Mon, 02 Nov 2009 17:15:34 -0800
commit

122b433bb1ad4cf50896186944ed0820e8041303

parent

e52387c48cbe1e81224141e45490cc9d096eab82

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

jump to
M test/markup_test.rbtest/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