test/test_creole.rb in creole-0.3.5 vs test/test_creole.rb in creole-0.3.6
- old
+ new
@@ -1,15 +1,19 @@
require 'test/unit'
require 'creole'
require 'cgi'
class TestCreole < Test::Unit::TestCase
- def tc(html, creole)
- output = Creole.creolize(creole)
+ def tc(html, creole, options = {})
+ output = Creole.creolize(creole, options)
assert html === output, "Parsing: #{creole.inspect}\nExpected: #{html.inspect}\n Was: #{output.inspect}"
end
+ def tce(html, creole)
+ tc(html, creole, :extensions => true)
+ end
+
def run_file(file)
html = File.read(file.sub('.creole', '.html'))
output = Creole.creolize(File.read(file))
puts html
@@ -626,7 +630,32 @@
end
def test_bold_combo
tc("<p><strong>bold and</strong></p><table><tr><td>table</td></tr></table><p>end<strong></strong></p>",
"**bold and\n|table|\nend**")
+ end
+
+ def test_extensions
+ tc("<p>This is not __underlined__</p>",
+ "This is not __underlined__")
+
+ tce("<p>This is <u>underlined</u></p>",
+ "This is __underlined__")
+
+ tce("<p>This is <del>deleted</del></p>",
+ "This is --deleted--")
+
+ tce("<p>This is <ins>inserted</ins></p>",
+ "This is ++inserted++")
+
+ tce("<p>This is <sup>super</sup></p>",
+ "This is ^^super^^")
+
+ tce("<p>This is <sub>sub</sub></p>",
+ "This is ~~sub~~")
+
+ tce("<p>®</p>", "(R)")
+ tce("<p>®</p>", "(r)")
+ tce("<p>©</p>", "(C)")
+ tce("<p>©</p>", "(c)")
end
end