diff options
author | Eric Wong <e@80x24.org> | 2019-04-18 23:49:42 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-04-18 23:50:32 +0000 |
commit | e55bef366b87ecbcb66c93669f41876afc1d2446 (patch) | |
tree | d074edb75087809cae2c656d3f75166d404a89fc /t | |
parent | f94c3a195a25a31d0215cd175938008fca473378 (diff) | |
download | public-inbox-e55bef366b87ecbcb66c93669f41876afc1d2446.tar.gz |
Dangling parentheses with trailing punctuation usually means the parentheses is not intended as part of the URL.
Diffstat (limited to 't')
-rw-r--r-- | t/linkify.t | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/t/linkify.t b/t/linkify.t index bef4ffd6..fe218b91 100644 --- a/t/linkify.t +++ b/t/linkify.t @@ -50,6 +50,11 @@ use PublicInbox::Linkify; $s = $l->linkify_2($s); is($s, qq(hello <a\nhref="$u">$u</a> world), 'URL preserved'); + $s = "$u. hi"; + $s = $l->linkify_1($s); + $s = $l->linkify_2($s); + is($s, qq(<a\nhref="$u">$u</a>. hi), 'paired () in URL OK'); + $u .= "?query=a"; $s = "hello $u world"; $s = $l->linkify_1($s); @@ -117,4 +122,14 @@ use PublicInbox::Linkify; } } +# dangling ')' cf. see MaintNotes in git.git todo branch +{ + my $l = PublicInbox::Linkify->new; + my $s = '(see http://example.com/).'; + $s = $l->linkify_1($s); + $s = $l->linkify_2($s); + like($s, qr!\(see <a[^>]+>http://example\.com/</a>\)\.!s, + 'punctuation with unpaired ) OK') +} + done_testing(); |