public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
mephisto / vendor / RedCloth-3.0.4 / run-tests.rb
100644 29 lines (26 sloc) 0.82 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env ruby
require 'lib/redcloth'
require 'yaml'
 
Dir["tests/*.yml"].each do |testfile|
    YAML::load_documents( File.open( testfile ) ) do |doc|
        if doc['in'] and doc['out']
            opts = []
            opts << :hard_breaks if testfile =~ /hard_breaks/
            red = RedCloth.new( doc['in'], opts )
            html = if testfile =~ /markdown/
                       red.to_html( :markdown )
                   else
                       red.to_html
                   end
            puts "---"
 
            html.gsub!( /\n+/, "\n" )
            doc['out'].gsub!( /\n+/, "\n" )
            if html == doc['out']
                puts "success: true"
            else
                puts "out: "; p html
                puts "expected: "; p doc['out']
            end
        end
    end
end