diff options
author | Gervase Markham <gerv@mozilla.org> | 2017-02-26 03:54:49 +0100 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2017-02-26 04:14:56 +0100 |
commit | d045206593953ebfeb22858baa25e8c2fe565e33 (patch) | |
tree | e728b094024a8cba884b22db30e45d037a8b03b7 /t/100markdown.t | |
parent | 4480c8ca91365aa60c60f371a6cc2fd3f22a1ff1 (diff) | |
download | bugzilla-d045206593953ebfeb22858baa25e8c2fe565e33.tar.gz bugzilla-d045206593953ebfeb22858baa25e8c2fe565e33.tar.xz |
Bug 1174341 - only treat emphasis markdown based on spaces
Diffstat (limited to 't/100markdown.t')
-rw-r--r-- | t/100markdown.t | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/t/100markdown.t b/t/100markdown.t index 70dece55f..217912bf9 100644 --- a/t/100markdown.t +++ b/t/100markdown.t @@ -12,7 +12,8 @@ use strict; use warnings; use lib qw(. lib local/lib/perl5 t); -use Test2::Bundle::Extended; +use Test2::Tools::Mock; +use Test::More; use Bugzilla::Util; BEGIN { my $terms = { @@ -45,6 +46,8 @@ use Bugzilla::Bug; use Bugzilla::Comment; use Bugzilla::User; use Bugzilla::Markdown; +use Bugzilla::Util; +use File::Basename; Bugzilla->usage_mode(USAGE_MODE_TEST); Bugzilla->error_mode(ERROR_MODE_DIE); @@ -71,19 +74,24 @@ my $comment = Bugzilla::Comment->new(already_wrapped => 0); Bugzilla->set_user($user); -my $markdown_text = <<MARKDOWN; -``` -this is a block -> with an embedded blockquote -``` -MARKDOWN +my @testfiles = glob("t/markdown/*.md"); -my $markdown = Bugzilla::Markdown->new(); +plan(tests => scalar(@testfiles) + 1); +my $markdown = Bugzilla::Markdown->new(); ok($markdown, "got a new markdown object"); -my $markdown_html = $markdown->markdown($markdown_text, $bug, $comment); -is("<pre><code>this is a block\n" - . "> with an embedded blockquote</code></pre>\n", - $markdown_html, "code block with embedded block quote"); -done_testing; +foreach my $testfile (@testfiles) { + my $data = read_text($testfile); + + my ($markdown_text, $expected_html) = split(/---/, $data); + $markdown_text = trim($markdown_text); + $expected_html = trim($expected_html); + + my $actual_html = $markdown->markdown($markdown_text, $bug, $comment); + $actual_html = trim($actual_html); + + is($actual_html, $expected_html, basename($testfile)); +} + +done_testing(); |