Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 47 lines (36 sloc) 1.435 kB
e2fb82d Added new test suite based on examples in RFC 3986 and fixed parser f…
U-ron-PC\ron authored
1 use v6;
2 use Test;
eb83019 Fixed test count in rfc-3986-examples.t
U-ron-PC\ron authored
3 plan 22;
e2fb82d Added new test suite based on examples in RFC 3986 and fixed parser f…
U-ron-PC\ron authored
4
5 use URI;
6 my $u = URI.new;
7
8 $u.init('ftp://ftp.is.co.za/rfc/rfc1808.txt');
9 is($u.scheme, 'ftp', 'ftp scheme');
10 is($u.host, 'ftp.is.co.za', 'ftp host');
11 is($u.path, '/rfc/rfc1808.txt', 'ftp path');
12
13 $u.init('http://www.ietf.org/rfc/rfc2396.txt');
14 is($u.scheme, 'http', 'http scheme');
15 is($u.host, 'www.ietf.org', 'http host');
16 is($u.path, '/rfc/rfc2396.txt', 'http path');
17
18 $u.init('ldap://[2001:db8::7]/c=GB?objectClass?one');
19 is($u.scheme, 'ldap', 'ldap scheme');
20 is($u.host, '[2001:db8::7]', 'ldap host');
21 is($u.path, '/c=gb', 'ldap path');
22 is($u.query, 'objectClass?one', 'ldap query');
23
24 $u.init('mailto:John.Doe@example.com');
25 is($u.scheme, 'mailto', 'mailto scheme');
26 is($u.path, 'john.doe@example.com', 'news path');
27
28 $u.init('news:comp.infosystems.www.servers.unix');
29 is($u.scheme, 'news', 'news scheme');
30 is($u.path, 'comp.infosystems.www.servers.unix', 'news path');
31
32 $u.init('tel:+1-816-555-1212');
33 is($u.scheme, 'tel', 'telephone scheme');
34 is($u.path, '+1-816-555-1212', 'telephone path');
35
36 $u.init('telnet://192.0.2.16:80/');
37 is($u.scheme, 'telnet', 'telnet scheme');
38 is($u.authority, '192.0.2.16:80', 'telnet authority');
39 is($u.host, '192.0.2.16', 'telnet host');
40 is($u.port, '80', 'telnet port');
41
42 $u.init('urn:oasis:names:specification:docbook:dtd:xml:4.1.2');
43 is($u.scheme, 'urn', 'urn scheme');
44 is($u.path, 'oasis:names:specification:docbook:dtd:xml:4.1.2', 'urn path');
45
46 # vim:ft=perl6
Something went wrong with that request. Please try again.