X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Flei_external.t;fp=t%2Flei_external.t;h=1f0048a10ca654a6c85d2caf419daf04830e7a24;hb=ec1f473957a529cc51a381e64274e42c03c6487b;hp=0000000000000000000000000000000000000000;hpb=c39a2d8bb1ee6e062030e21f6b0f638990234b2e;p=public-inbox.git diff --git a/t/lei_external.t b/t/lei_external.t new file mode 100644 index 00000000..1f0048a1 --- /dev/null +++ b/t/lei_external.t @@ -0,0 +1,18 @@ +#!perl -w +use strict; +use v5.10.1; +use Test::More; +my $cls = 'PublicInbox::LeiExternal'; +require_ok $cls; +my $canon = $cls->can('_canonicalize'); +my $exp = 'https://example.com/my-inbox/'; +is($canon->('https://example.com/my-inbox'), $exp, 'trailing slash added'); +is($canon->('https://example.com/my-inbox//'), $exp, 'trailing slash removed'); +is($canon->('https://example.com//my-inbox/'), $exp, 'leading slash removed'); +is($canon->('https://EXAMPLE.com/my-inbox/'), $exp, 'lowercased'); +is($canon->('/this/path/is/nonexistent/'), '/this/path/is/nonexistent', + 'non-existent pathname canonicalized'); +is($canon->('/this//path/'), '/this/path', 'extra slashes gone'); +is($canon->('/ALL/CAPS'), '/ALL/CAPS', 'caps preserved'); + +done_testing;