summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-05-02 06:57:29 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-05-02 06:57:29 +0000
commitbcc5ac38f3b77d050857fd33ee1a6e2d31828399 (patch)
tree53fbf1c2dc98989e4de60af6d754442b1e402c80 /test/unit
parent9875ed9954c82a656b77b56af27ced25a5da73bb (diff)
downloadredmine-bcc5ac38f3b77d050857fd33ee1a6e2d31828399.tar.gz
redmine-bcc5ac38f3b77d050857fd33ee1a6e2d31828399.zip
Crash in markdown formatter causes ruby process to end (#16781).
Patch by Jens Krämer. git-svn-id: http://svn.redmine.org/redmine/trunk@13122 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/lib/redmine/wiki_formatting/markdown_formatter.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/lib/redmine/wiki_formatting/markdown_formatter.rb b/test/unit/lib/redmine/wiki_formatting/markdown_formatter.rb
index 98a55eb5f..811f28133 100644
--- a/test/unit/lib/redmine/wiki_formatting/markdown_formatter.rb
+++ b/test/unit/lib/redmine/wiki_formatting/markdown_formatter.rb
@@ -24,6 +24,18 @@ class Redmine::WikiFormatting::MarkdownFormatterTest < ActionView::TestCase
@formatter = Redmine::WikiFormatting::Markdown::Formatter
end
+ def test_syntax_error_in_image_reference_should_not_raise_exception
+ assert @formatter.new("!>[](foo.png)").to_html
+ end
+
+ # re-using the formatter after getting above error crashes the
+ # ruby interpreter. This seems to be related to
+ # https://github.com/vmg/redcarpet/issues/318
+ def test_should_not_crash_redcarpet_after_syntax_error
+ @formatter.new("!>[](foo.png)").to_html rescue nil
+ assert @formatter.new("![](foo.png)").to_html.present?
+ end
+
def test_inline_style
assert_equal "<p><strong>foo</strong></p>", @formatter.new("**foo**").to_html.strip
end