文本文件  |  64行  |  3.05 KB

Test resolution of relative URLs.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS canonicalize('http://another/') is 'http://another/'
PASS canonicalize('http:////another/') is 'http://another/'
PASS canonicalize('') is 'http://foo/bar'
PASS canonicalize('') is 'http://foo/bar'
PASS canonicalize('') is 'http://foo/bar'
PASS canonicalize('  another  ') is 'http://foo/another'
PASS canonicalize('  .  ') is 'http://foo/'
PASS canonicalize(' 	 ') is 'http://foo/bar'
PASS canonicalize('http:path') is 'http://host/path'
PASS canonicalize('http:path') is 'http://host/a/path'
FAIL canonicalize('http:/path') should be http://host/path. Was http://path/.
FAIL canonicalize('HTTP:/path') should be http://host/path. Was http:/path.
PASS canonicalize('https:host2') is 'https://host2/'
PASS canonicalize('htto:/host2') is 'htto:/host2'
PASS canonicalize('/b/c/d') is 'http://host/b/c/d'
PASS canonicalize('\\b\\c\\d') is 'http://host/b/c/d'
PASS canonicalize('/b/../c') is 'http://host/c'
PASS canonicalize('/b/../c') is 'http://host/c'
PASS canonicalize('\\b/../c?x#y') is 'http://host/c?x#y'
PASS canonicalize('/b/../c?x#y') is 'http://host/c?x#y'
PASS canonicalize('b') is 'http://host/b'
PASS canonicalize('bc/de') is 'http://host/bc/de'
PASS canonicalize('bc/de?query#ref') is 'http://host/a/bc/de?query#ref'
PASS canonicalize('.') is 'http://host/a/'
PASS canonicalize('..') is 'http://host/'
PASS canonicalize('./..') is 'http://host/'
PASS canonicalize('../.') is 'http://host/'
PASS canonicalize('././.') is 'http://host/a/'
PASS canonicalize('../../../foo') is 'http://host/foo'
PASS canonicalize('?foo=bar') is 'http://host/a?foo=bar'
PASS canonicalize('?') is 'http://host/a?'
PASS canonicalize('?foo=bar#com') is 'http://host/a?foo=bar#com'
PASS canonicalize('#ref') is 'http://host/a#ref'
PASS canonicalize('#') is 'http://host/a#'
PASS canonicalize('#bye') is 'http://host/a?foo=bar#bye'
FAIL canonicalize('baz.html') should be . Was baz.html.
PASS canonicalize('data:baz') is 'data:baz'
PASS canonicalize('data:/base') is 'data:/base'
PASS canonicalize('http://host/') is 'http://host/'
PASS canonicalize('http:host') is 'http://host/'
PASS canonicalize('./asd:fgh') is 'http://foo/asd:fgh'
PASS canonicalize(':foo') is 'http://foo/:foo'
PASS canonicalize(' hello world') is 'http://foo/hello%20world'
FAIL canonicalize(':foo') should be . Was :foo.
PASS canonicalize(';foo') is 'http://host/;foo'
PASS canonicalize(';foo') is 'http://host/;foo'
PASS canonicalize(';/../bar') is 'http://host/bar'
PASS canonicalize('//another') is 'http://another/'
PASS canonicalize('//another/path?query#ref') is 'http://another/path?query#ref'
FAIL canonicalize('///another/path') should be http://another/path. Was http:/another/path.
FAIL canonicalize('//Another\\path') should be http://another/path. Was http://Another/path.
FAIL canonicalize('//') should be http:. Was http:/.
PASS canonicalize('\\/another/path') is 'http://another/path'
FAIL canonicalize('/\\Another\\path') should be http://another/path. Was http://Another/path.
PASS successfullyParsed is true

TEST COMPLETE