instiki/vendor/RedCloth-3.0.3/run-tests.rb

27 lines
730 B
Ruby
Raw Normal View History

2005-01-15 21:26:54 +01:00
#!/usr/bin/env ruby
2005-02-11 00:11:47 +01:00
require 'lib/redcloth'
2005-01-15 21:26:54 +01:00
require 'yaml'
Dir["tests/*.yml"].each do |testfile|
YAML::load_documents( File.open( testfile ) ) do |doc|
if doc['in'] and doc['out']
2005-02-11 00:11:47 +01:00
red = RedCloth.new( doc['in'] )
html = if testfile =~ /markdown/
red.to_html( :markdown )
else
red.to_html
end
2005-01-15 21:26:54 +01:00
puts "---"
2005-02-11 00:11:47 +01:00
html.gsub!( /\n+/, "\n" )
doc['out'].gsub!( /\n+/, "\n" )
2005-01-15 21:26:54 +01:00
if html == doc['out']
puts "success: true"
else
puts "out: "; p html
puts "expected: "; p doc['out']
end
end
end
end