about summary refs log tree commit homepage
path: root/t/hval.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-01-18 21:16:14 +0000
committerEric Wong <e@80x24.org>2016-04-05 18:58:27 +0000
commitfa8e2e7e001d7585d6e41c254ee4443a1672bca5 (patch)
tree81a4e40fea90aa27f3c49b32333da841b5c54b0f /t/hval.t
parentb89e53a37e14f5f659c94f8c880e2cf4b7efe1b4 (diff)
downloadpublic-inbox-fa8e2e7e001d7585d6e41c254ee4443a1672bca5.tar.gz
We'll use HTML attributes + anchor links to link to filenames
in coming commits.
Diffstat (limited to 't/hval.t')
-rw-r--r--t/hval.t20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/hval.t b/t/hval.t
new file mode 100644
index 00000000..f824752c
--- /dev/null
+++ b/t/hval.t
@@ -0,0 +1,20 @@
+# Copyright (C) 2015 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ (https://www.gnu.org/licenses/agpl-3.0.txt)
+use strict;
+use warnings;
+use Test::More;
+use PublicInbox::Hval qw(to_attr from_attr);
+
+foreach my $s ('Hello/World.pm', 'Zcat', 'hello world.c', 'Eléanor', '$at') {
+        my $attr = to_attr($s);
+        is(from_attr($attr), $s, "$s => $attr => $s round trips");
+}
+
+{
+        my $bad = eval { to_attr('foo//bar') };
+        my $err = $@;
+        ok(!$bad, 'double-slash rejected');
+        like($err, qr/invalid filename:/, 'got exception message');
+}
+
+done_testing();