Canonicalization of file URLs when the base URL is an http URL On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". PASS canonicalize('file:c:\\foo\\bar.html') is 'file:///C:/foo/bar.html' PASS canonicalize(' File:c|////foo\\bar.html') is 'file:///C:////foo/bar.html' PASS canonicalize('file:') is 'file:///' PASS canonicalize('file:UNChost/path') is 'file://unchost/path' PASS canonicalize('c:\\foo\\bar') is 'file:///C:/foo/bar' PASS canonicalize('C|/foo/bar') is 'file:///C:/foo/bar' FAIL canonicalize('/C|\\foo\\bar') should be file:///C:/foo/bar. Was http://example.com/C%7C/foo/bar. FAIL canonicalize('//C|/foo/bar') should be file:///C:/foo/bar. Was http://c%7C/foo/bar. FAIL canonicalize('//server/file') should be file://server/file. Was http://server/file. PASS canonicalize('\\\\server\\file') is 'file://server/file' FAIL canonicalize('/\\server/file') should be file://server/file. Was http://server/file. PASS canonicalize('file:c:foo/bar.html') is 'file:///C:/foo/bar.html' PASS canonicalize('file:/\\/\\C:\\\\//foo\\bar.html') is 'file:///C:////foo/bar.html' PASS canonicalize('file:///foo/bar.txt') is 'file:///foo/bar.txt' PASS canonicalize('FILE:/\\/\\7:\\\\//foo\\bar.html') is 'file://7:////foo/bar.html' PASS canonicalize('file:filer/home\\me') is 'file://filer/home/me' PASS canonicalize('file:///C:/foo/../../../bar.html') is 'file:///C:/bar.html' PASS canonicalize('file:///C:/asdf#\xc2') is 'file:///C:/asdf#\xc2' PASS canonicalize('file:///C:/asdf#Â') is 'file:///C:/asdf#Â' PASS canonicalize('file:///home/me') is 'file:///home/me' FAIL canonicalize('file:c:\\foo\\bar.html') should be file:///c:/foo/bar.html. Was file:///C:/foo/bar.html. FAIL canonicalize('file:c|//foo\\bar.html') should be file:///c%7C//foo/bar.html. Was file:///C://foo/bar.html. FAIL canonicalize('//') should be file:///. Was http:. FAIL canonicalize('///') should be file:///. Was http:. FAIL canonicalize('///test') should be file:///test. Was http://test/. PASS canonicalize('file://test') is 'file://test/' PASS canonicalize('file://localhost') is 'file://localhost/' PASS canonicalize('file://localhost/') is 'file://localhost/' PASS canonicalize('file://localhost/test') is 'file://localhost/test' PASS successfullyParsed is true TEST COMPLETE