文本文件  |  26行  |  1.27 KB

Test resolution of relative Windows-like URLs.

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


PASS canonicalize('http://host/') is 'http://host/'
PASS canonicalize('bar') is 'file:///C:/bar'
FAIL canonicalize('../../../bar.html') should be file:///C:/bar.html. Was file:///bar.html.
FAIL canonicalize('/../bar.html') should be file:///C:/bar.html. Was file:///bar.html.
FAIL canonicalize('\\\\another\\path') should be . Was http://another/path.
FAIL canonicalize('//c:/foo') should be file:///C:/foo. Was file://c/foo.
FAIL canonicalize('//localhost/c:/foo') should be file:///C:/foo. Was file:///c:/foo.
FAIL canonicalize('c:') should be . Was c:.
FAIL canonicalize('c:/foo') should be . Was c:/foo.
FAIL canonicalize('c:\\foo') should be . Was c:/foo.
FAIL canonicalize('/z:/bar') should be file:///Z:/bar. Was file:///z:/bar.
FAIL canonicalize('/bar') should be file:///C:/bar. Was file:///bar.
FAIL canonicalize('/bar') should be file://localhost/C:/bar. Was file:///bar.
FAIL canonicalize('/bar') should be file:///C:/bar. Was file:///bar.
PASS canonicalize('//somehost/path') is 'file://somehost/path'
FAIL canonicalize('/\\//somehost/path') should be file://somehost/path. Was file:////somehost/path.
PASS successfullyParsed is true

TEST COMPLETE