diff options
Diffstat (limited to 't/01-grammar.t')
-rw-r--r-- | t/01-grammar.t | 20 |
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 |