1 Test resolution of relative URLs.
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
6 PASS canonicalize('http://another/') is 'http://another/'
7 PASS canonicalize('http:////another/') is 'http://another/'
8 PASS canonicalize('') is 'http://foo/bar'
9 PASS canonicalize('') is 'http://foo/bar'
10 PASS canonicalize('') is 'http://foo/bar'
11 PASS canonicalize(' another ') is 'http://foo/another'
12 PASS canonicalize(' . ') is 'http://foo/'
13 PASS canonicalize(' ') is 'http://foo/bar'
14 PASS canonicalize('http:path') is 'http://host/path'
15 PASS canonicalize('http:path') is 'http://host/a/path'
16 PASS canonicalize('http:/path') is 'http://host/path'
17 PASS canonicalize('HTTP:/path') is 'http://host/path'
18 PASS canonicalize('https:host2') is 'https://host2/'
19 PASS canonicalize('htto:/host2') is 'htto:/host2'
20 PASS canonicalize('/b/c/d') is 'http://host/b/c/d'
21 PASS canonicalize('\\b\\c\\d') is 'http://host/b/c/d'
22 PASS canonicalize('/b/../c') is 'http://host/c'
23 PASS canonicalize('/b/../c') is 'http://host/c'
24 PASS canonicalize('\\b/../c?x#y') is 'http://host/c?x#y'
25 PASS canonicalize('/b/../c?x#y') is 'http://host/c?x#y'
26 PASS canonicalize('b') is 'http://host/b'
27 PASS canonicalize('bc/de') is 'http://host/bc/de'
28 PASS canonicalize('bc/de?query#ref') is 'http://host/a/bc/de?query#ref'
29 PASS canonicalize('.') is 'http://host/a/'
30 PASS canonicalize('..') is 'http://host/'
31 PASS canonicalize('./..') is 'http://host/'
32 PASS canonicalize('../.') is 'http://host/'
33 PASS canonicalize('././.') is 'http://host/a/'
34 PASS canonicalize('../../../foo') is 'http://host/foo'
35 PASS canonicalize('?foo=bar') is 'http://host/a?foo=bar'
36 PASS canonicalize('?') is 'http://host/a?'
37 PASS canonicalize('?foo=bar#com') is 'http://host/a?foo=bar#com'
38 PASS canonicalize('#ref') is 'http://host/a#ref'
39 PASS canonicalize('#') is 'http://host/a#'
40 PASS canonicalize('#bye') is 'http://host/a?foo=bar#bye'
41 PASS canonicalize('baz.html') is ''
42 PASS canonicalize('data:baz') is 'data:baz'
43 PASS canonicalize('data:/base') is 'data:/base'
44 PASS canonicalize('http://host/') is 'http://host/'
45 PASS canonicalize('http:host') is 'http://host/'
46 PASS canonicalize('./asd:fgh') is 'http://foo/asd:fgh'
47 PASS canonicalize(':foo') is 'http://foo/:foo'
48 PASS canonicalize(' hello world') is 'http://foo/hello%20world'
49 PASS canonicalize(':foo') is ''
50 PASS canonicalize(';foo') is 'http://host/;foo'
51 PASS canonicalize(';foo') is 'http://host/;foo'
52 PASS canonicalize(';/../bar') is 'http://host/bar'
53 PASS canonicalize('//another') is 'http://another/'
54 PASS canonicalize('//another/path?query#ref') is 'http://another/path?query#ref'
55 PASS canonicalize('///another/path') is 'http://another/path'
56 PASS canonicalize('//Another\\path') is 'http://another/path'
57 PASS canonicalize('//') is 'http:'
58 PASS canonicalize('\\/another/path') is 'http://another/path'
59 PASS canonicalize('/\\Another\\path') is 'http://another/path'
60 PASS successfullyParsed is true