Permalink
Browse files

Added a test case for rdiscount toc rendering.

  • Loading branch information...
mkaito authored and mojombo committed Nov 1, 2011
1 parent f5b2acf commit fd5447a6e6921b3f3d465ae7bc105b3dd7940fa3
Showing with 5 additions and 1 deletion.
  1. +5 −1 test/test_rdiscount.rb
@@ -5,7 +5,7 @@ class TestRdiscount < Test::Unit::TestCase
context "rdiscount" do
setup do
config = {
'rdiscount' => { 'extensions' => ['smart'] },
'rdiscount' => { 'extensions' => ['smart', 'generate_toc'], 'toc_token' => '{:toc}' },
'markdown' => 'rdiscount'
}
@markdown = MarkdownConverter.new config
@@ -14,5 +14,9 @@ class TestRdiscount < Test::Unit::TestCase
should "pass rdiscount extensions" do
assert_equal "<p>&ldquo;smart&rdquo;</p>", @markdown.convert('"smart"').strip
end
should "render toc" do
assert_equal "<h1 id=\"Header+1\">Header 1</h1>\n\n<h2 id=\"Header+2\">Header 2</h2>\n\n<p>\n <ul>\n <li><a href=\"#Header+1\">Header 1</a>\n <ul>\n <li><a href=\"#Header+2\">Header 2</a> </li>\n </ul>\n </li>\n </ul>\n\n</p>", @markdown.convert("# Header 1\n\n## Header 2\n\n{:toc}").strip
end
end
end

0 comments on commit fd5447a

Please sign in to comment.