aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2020-01-06 17:08:59 +0100
committerPatrick Spek <p.spek@tyil.nl>2020-01-06 17:08:59 +0100
commit5b8009dbd06f9a09065843de8eb5f8f680bb4f37 (patch)
tree126eeaec3ab07312dd4f5c32f56faa47d4d6435b /t
parent9b6ceba4f1df99b262ebbcffcdb30b1ed16f9b42 (diff)
Fix trailing / in URLsHEADmaster
Thanks to chacewells@gmail.com for reporting this issue.
Diffstat (limited to 't')
-rw-r--r--t/01-grammar.t20
1 files changed, 19 insertions, 1 deletions
diff --git a/t/01-grammar.t b/t/01-grammar.t
index a84bf86..cf4e51f 100644
--- a/t/01-grammar.t
+++ b/t/01-grammar.t
@@ -5,7 +5,7 @@ use v6.d;
use URL::Grammar;
use Test;
-plan 2;
+plan 3;
subtest "https://www.tyil.nl", {
plan 8;
@@ -58,4 +58,22 @@ subtest "https://tyil:donthackme\@www.tyil.nl:8443/a/path/part?foo=bar&perl=6#mo
}
}
+subtest 'https://custom.endpoint/foo/bar/', {
+ plan 11;
+
+ my $match = URL::Grammar.parse('https://custom.endpoint/foo/bar/');
+
+ is ~$match<scheme>, "https", "Scheme is 'https'";
+ nok $match<userinfo><username>, 'URL contains no username';
+ nok $match<userinfo><password>, 'URL contains no password';
+ is ~$match<host><hostname>, 'custom.endpoint', "Hostname is 'custom.endpoint'";
+ nok $match<host><port>, 'URL contains no port';
+ ok $match<path>, 'URL contains a path';
+ is $match<path><part>.elems, 2, 'Path contains 2 elements';
+ is ~$match<path><part>[0], 'foo', 'Path part 0 is "foo"';
+ is ~$match<path><part>[1], 'bar', 'Path part 0 is "bar"';
+ nok $match<query>, 'URL contains no query';
+ nok $match<fragment>, 'URL contains no fragment';
+}
+
# vim: ft=perl6 noet