diff options
author | Simon McVittie <smcv@debian.org> | 2015-01-06 00:26:41 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2015-01-06 00:28:18 +0000 |
commit | 6b6d330bade5244b4457405cd144f5bf2f9de0ae (patch) | |
tree | 1bda00d98987d4439524ebcba90362bd8dcfb0b6 | |
parent | 4315581f31498c7c791fab2b251359c99533760f (diff) | |
download | ikiwiki-6b6d330bade5244b4457405cd144f5bf2f9de0ae.tar ikiwiki-6b6d330bade5244b4457405cd144f5bf2f9de0ae.tar.gz |
textile-double-escape-bug.t: tolerate any valid encoding
Discount in current Debian unstable turns the IURI href into a URI
by encoding the Unicode as UTF-8 and %-escaping each byte.
That is valid, and matches Wikipedia's expectations, but was breaking
this test for me.
It would also be entirely valid (and lead to equivalent parsing) if the
ö was represented as ö, ö or ö in the text and/or the href.
-rwxr-xr-x | t/textile-double-escape-bug.t | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/t/textile-double-escape-bug.t b/t/textile-double-escape-bug.t index 607706be4..f8ab3f7e1 100755 --- a/t/textile-double-escape-bug.t +++ b/t/textile-double-escape-bug.t @@ -14,20 +14,22 @@ BEGIN { subtest 'Text::Textile apparently double-escapes HTML entities in hrefs' => sub { my $text = q{Gödel, Escher, Bach}; + my $text_ok = qr{G(?:ö|ö|ö|&#x[fF]6;)del, Escher, Bach}; my $href = q{https://en.wikipedia.org/wiki/Gödel,_Escher,_Bach}; - my $good = qq{<p><a href="$href">$text</a></p>}; + my $href_ok = qr{https://en\.wikipedia\.org/wiki/G(?:ö|ö|ö|&#x[fF]6|%[cC]3%[bB]6)del,_Escher,_Bach}; + my $good = qr{<p><a href="$href_ok">$text_ok</a></p>}; chomp(my $mdwn_html = IkiWiki::Plugin::mdwn::htmlize( content => qq{[$text]($href)}, )); - is($mdwn_html, $good); + like($mdwn_html, $good); chomp(my $txtl_html = IkiWiki::Plugin::textile::htmlize( content => qq{"$text":$href}, )); TODO: { local $TODO = "Text::Textile double-escapes the href"; - is($txtl_html, $good); - isnt($txtl_html, q{<p><a href="https://en.wikipedia.org/wiki/G&ouml;del,_Escher,_Bach">Gödel, Escher, Bach</a></p>}); + like($txtl_html, $good); + unlike($txtl_html, qr{<p><a href="https://en\.wikipedia\.org/wiki/G&ouml;del,_Escher,_Bach">Gödel, Escher, Bach</a></p>}i); } }; |