test/markup_test.rb (view raw)
1$LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib"
2
3require 'github/markup'
4
5def test_markup
6 passed = true
7 Dir['test/markups/README.*'].each do |readme|
8 next if readme =~ /html$/
9 markup = readme.split('.').last
10
11 expected = File.read("#{readme}.html")
12 actual = GitHub::Markup.render(readme, File.read(readme))
13
14 if expected == actual
15 puts "- #{markup}: OK"
16 else
17 passed = false
18 puts "- #{markup}: FAIL"
19 puts "#{markup} expected:", expected
20 puts "#{markup} actual:", actual
21 end
22 end
23 passed
24end
25
26at_exit do
27 exit test_markup ? 0 : 1
28end