$LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib" require 'github/markup' require 'test/unit' class MarkupTest < Test::Unit::TestCase Dir['test/markups/README.*'].each do |readme| next if readme =~ /html$/ markup = readme.split('/').last.gsub(/^README\./, '') define_method "test_#{markup}" do source = File.read(readme) expected_file = "#{readme}.html" expected = File.read(expected_file).rstrip actual = GitHub::Markup.render(readme, File.read(readme)).rstrip if source != expected assert(source != actual, "#{markup} did not render anything") end diff = IO.popen("diff -u - #{expected_file}", 'r+') do |f| f.write actual f.close_write f.read end assert expected == actual, <