]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/linkify.t
No ext_urls
[public-inbox.git] / t / linkify.t
index fe218b91f95c4a89e0d3eaea0e6a2d6052b39c53..9280fd91fcf70f5a3306ac14dc5d6de3b4c896c1 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2016-2018 all contributors <meta@public-inbox.org>
+# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use warnings;
@@ -132,4 +132,21 @@ use PublicInbox::Linkify;
                'punctuation with unpaired ) OK')
 }
 
+if ('IDN example: <ACDB98F4-178C-43C3-99C4-A1D03DD6A8F5@sb.org>') {
+       my $hc = '&#26376;';
+       my $u = "http://www.\x{6708}.example.com/";
+       my $s = $u;
+       my $l = PublicInbox::Linkify->new;
+       $s = $l->linkify_1($s);
+       $s = $l->linkify_2($s);
+       my $expect = qq{<a
+href="http://www.$hc.example.com/">http://www.$hc.example.com/</a>};
+       is($s, $expect, 'IDN message escaped properly');
+}
+
+{
+       my $false_positive = 'LINKIFY'.('A' x 40);
+       is(PublicInbox::Linkify->new->to_html($false_positive),
+               $false_positive, 'false-positive left as-is');
+}
 done_testing();