Skip to content

Commit

Permalink
perf(markup): add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhucheung committed Dec 21, 2018
1 parent 3e08f13 commit 32909da
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/markup_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def call
message
end
end

def test_knows_what_it_can_and_cannot_render
assert_equal false, GitHub::Markup.can_render?('README.html', '<h1>Title</h1>')
assert_equal true, GitHub::Markup.can_render?('README.markdown', '=== Title')
Expand All @@ -92,7 +92,7 @@ def test_each_render_has_a_name
assert_equal "pod", GitHub::Markup.renderer('README.pod', '=head1').name
assert_equal "pod6", GitHub::Markup.renderer('README.pod6', '=begin pod').name
end

def test_rendering_by_symbol
assert_equal '<p><code>test</code></p>', GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, '`test`').strip
end
Expand All @@ -117,5 +117,8 @@ def test_preserve_markup
def test_commonmarker_options
assert_equal "<p>hello <!-- raw HTML omitted --> world</p>\n", GitHub::Markup.render("test.md", "hello <bad> world")
assert_equal "<p>hello <bad> world</p>\n", GitHub::Markup.render("test.md", "hello <bad> world", options: {commonmarker_opts: [:UNSAFE]})

assert_equal "<p>hello <!-- raw HTML omitted --> world</p>\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "hello <bad> world")
assert_equal "<p>hello <bad> world</p>\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "hello <bad> world", options: {commonmarker_opts: [:UNSAFE]})
end
end

0 comments on commit 32909da

Please sign in to comment.