about summary refs log tree commit homepage
path: root/t/mid.t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-01-25 04:45:00 +0000
committerEric Wong <e@yhbt.net>2020-01-27 02:59:09 +0000
commita5c812fb9d39adcf6ae7e63c15177ac3ce0cadfb (patch)
tree7fe6aebe43203541626abd7d9edc271914e5f94e /t/mid.t
parente3e9ebdaaf2c2f8192fc003f1857979f933b9a8b (diff)
downloadpublic-inbox-a5c812fb9d39adcf6ae7e63c15177ac3ce0cadfb.tar.gz
And some more into t/mid.t.  PublicInbox::View::msg_html may
change internally, so lets rely on the stable PSGI interface
to test it, rather than a test which reaches deep into the
internals.
Diffstat (limited to 't/mid.t')
-rw-r--r--t/mid.t8
1 files changed, 7 insertions, 1 deletions
diff --git a/t/mid.t b/t/mid.t
index ecac04de..7005101f 100644
--- a/t/mid.t
+++ b/t/mid.t
@@ -2,12 +2,18 @@
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use Test::More;
-use PublicInbox::MID qw(mid_escape mids references mids_for_index);
+use PublicInbox::MID qw(mid_escape mids references mids_for_index id_compress);
 
 is(mid_escape('foo!@(bar)'), 'foo!@(bar)');
 is(mid_escape('foo%!@(bar)'), 'foo%25!@(bar)');
 is(mid_escape('foo%!@(bar)'), 'foo%25!@(bar)');
 
+# n.b: this is probably invalid since we dropped CGI for PSGI:
+like(id_compress('foo%bar@wtf'), qr/\A[a-f0-9]{40}\z/,
+        "percent always converted to sha1 to workaround buggy httpds");
+
+is(id_compress('foobar-wtf'), 'foobar-wtf', 'regular ID not compressed');
+
 {
         use Email::MIME;
         my $mime = Email::MIME->create;