From 1bd1dff6d449ab221e191679fd8ec516b7cc1d4e Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Mon, 8 Apr 2019 19:30:35 +0200 Subject: Initial commit --- t/04-stringification.t | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 t/04-stringification.t (limited to 't/04-stringification.t') diff --git a/t/04-stringification.t b/t/04-stringification.t new file mode 100644 index 0000000..4a50e5a --- /dev/null +++ b/t/04-stringification.t @@ -0,0 +1,38 @@ +#! /usr/bin/env perl6 + +use v6.d; + +use Test; +use URL; + +plan 2; + +subtest "https://www.tyil.nl", { + plan 4; + + my $url = URL.new( + scheme => "https", + hostname => "www.tyil.nl", + ); + + is $url.Str(:path), "", "Str(:path) = ''"; + is $url.Str(:query), "", "Str(:query) = ''"; + is $url.Str(:userinfo), "", "Str(:userinfo) = ''"; + is ~$url, "https://www.tyil.nl", "Str() = 'https://www.tyil.nl'"; +} + +subtest "https://tyil:donthackme\@www.tyil.nl:8443/a/path/part?foo=bar&perl=6#module", { + plan 4; + + my $url = URL.new("https://tyil:donthackme\@www.tyil.nl:8443/a/path/part?foo=bar&perl=6#module"); + + is $url.Str(:path), "a/path/part", "Str(:path) = 'a/path/part'"; + is $url.Str(:query), "foo=bar&perl=6", "Str(:query) = 'foo=bar&perl=6'"; + is $url.Str(:userinfo), "tyil:donthackme", "Str(:userinfo) = 'tyil:donthackme'"; + is ~$url, + "https://tyil:donthackme\@www.tyil.nl:8443/a/path/part?foo=bar&perl=6#module", + "Str() = 'https://tyil:donthackme\@www.tyil.nl:8443/a/path/part?foo=bar&perl=6#module'" + ; +} + +# vim: ft=perl6 noet -- cgit v1.1