about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-04-18 22:47:01 +0000
committerEric Wong <e@80x24.org>2019-04-18 22:50:09 +0000
commit348f6b2b271d3562509420070bd94d6ac00619dc (patch)
tree518417c4c984438987179731e90c433d5555e1d1 /t
parentb241b1ac6f8b0b47c69dad47716ac9b184e4c098 (diff)
downloadpublic-inbox-348f6b2b271d3562509420070bd94d6ac00619dc.tar.gz
The URLs at the top of WwwStream.pm weren't getting linkified
correctly.
Diffstat (limited to 't')
-rw-r--r--t/linkify.t19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/linkify.t b/t/linkify.t
index f0b3a6d0..bef4ffd6 100644
--- a/t/linkify.t
+++ b/t/linkify.t
@@ -98,4 +98,23 @@ use PublicInbox::Linkify;
                 'Markdown-compatible end of sentence');
 }
 
+# Perl and Ruby code compatibility
+{
+        my $l = PublicInbox::Linkify->new;
+        my $u = 'http://example.com/';
+        foreach my $q ("'%s'", '"%s"', 'q!%s!', 'q(%s)') {
+                # Perl
+                my $s = sprintf("my \$var = $q;", $u);
+                $s = $l->linkify_1($s);
+                $s = $l->linkify_2($s);
+                like($s, qr/>\Q$u\E</, "no quote($q) in URL");
+
+                # applies to Ruby, too
+                $s = sprintf("$q,", $u);
+                $s = $l->linkify_1($s);
+                $s = $l->linkify_2($s);
+                like($s, qr/>\Q$u\E</, "no quote($q) in URL array");
+        }
+}
+
 done_testing();