1Test URL segmentation 2 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 5 6PASS segments('http://user:pass@foo:21/bar;par?b#c') is '["http:","foo","21","/bar;par","?b","#c"]' 7PASS segments('http:foo.com') is '["http:","example.org","","/foo/foo.com","",""]' 8PASS segments('\t :foo.com \n') is '["http:","example.org","","/foo/:foo.com","",""]' 9PASS segments(' foo.com ') is '["http:","example.org","","/foo/foo.com","",""]' 10PASS segments('a:\t foo.com') is '["a:","",""," foo.com","",""]' 11PASS segments('http://f:21/ b ? d # e ') is '["http:","f","21","/%20b%20","?%20d%20","# e"]' 12PASS segments('http://f:/c') is '["http:","f","","/c","",""]' 13PASS segments('http://f:0/c') is '["http:","f","0","/c","",""]' 14PASS segments('http://f:00000000000000/c') is '["http:","f","0","/c","",""]' 15FAIL segments('http://f:00000000000000000000080/c') should be ["http:","f","0","/c","",""]. Was ["http:","f","80","/c","",""]. 16PASS segments('http://f:b/c') is '[":","","","","",""]' 17PASS segments('http://f: /c') is '[":","","","","",""]' 18PASS segments('http://f:\n/c') is '[":","","","","",""]' 19PASS segments('http://f:fifty-two/c') is '[":","","","","",""]' 20FAIL segments('http://f:999999/c') should be [":","","0","","",""]. Was ["http:","f","65535","/c","",""]. 21PASS segments('http://f: 21 / b ? d # e ') is '[":","","","","",""]' 22PASS segments('') is '["http:","example.org","","/foo/bar","",""]' 23PASS segments(' \t') is '["http:","example.org","","/foo/bar","",""]' 24PASS segments(':foo.com/') is '["http:","example.org","","/foo/:foo.com/","",""]' 25PASS segments(':foo.com\\') is '["http:","example.org","","/foo/:foo.com/","",""]' 26PASS segments(':') is '["http:","example.org","","/foo/:","",""]' 27PASS segments(':a') is '["http:","example.org","","/foo/:a","",""]' 28PASS segments(':/') is '["http:","example.org","","/foo/:/","",""]' 29PASS segments(':\\') is '["http:","example.org","","/foo/:/","",""]' 30PASS segments(':#') is '["http:","example.org","","/foo/:","",""]' 31PASS segments('#') is '["http:","example.org","","/foo/bar","",""]' 32PASS segments('#/') is '["http:","example.org","","/foo/bar","","#/"]' 33PASS segments('#\\') is '["http:","example.org","","/foo/bar","","#\\\\"]' 34PASS segments('#;?') is '["http:","example.org","","/foo/bar","","#;?"]' 35PASS segments('?') is '["http:","example.org","","/foo/bar","",""]' 36PASS segments('/') is '["http:","example.org","","/","",""]' 37PASS segments(':23') is '["http:","example.org","","/foo/:23","",""]' 38PASS segments('/:23') is '["http:","example.org","","/:23","",""]' 39FAIL segments('//') should be [":","","","","",""]. Was ["http:","","","/","",""]. 40PASS segments('::') is '["http:","example.org","","/foo/::","",""]' 41PASS segments('::23') is '["http:","example.org","","/foo/::23","",""]' 42PASS segments('foo://') is '["foo:","","","//","",""]' 43PASS segments('http://a:b@c:29/d') is '["http:","c","29","/d","",""]' 44PASS segments('http::@c:29') is '["http:","example.org","","/foo/:@c:29","",""]' 45FAIL segments('http://&a:foo(b]c@d:2/') should be ["http:","d","2","/","",""]. Was [":","","","","",""]. 46FAIL segments('http://::@c@d:2') should be ["http:","d","2","/","",""]. Was [":","","","","",""]. 47PASS segments('http://foo.com:b@d/') is '["http:","d","","/","",""]' 48PASS segments('http://foo.com/\\@') is '["http:","foo.com","","//@","",""]' 49PASS segments('http:\\\\foo.com\\') is '["http:","foo.com","","/","",""]' 50PASS segments('http:\\\\a\\b:c\\d@foo.com\\') is '["http:","a","","/b:c/d@foo.com/","",""]' 51PASS segments('foo:/') is '["foo:","","","/","",""]' 52PASS segments('foo:/bar.com/') is '["foo:","","","/bar.com/","",""]' 53PASS segments('foo://///////') is '["foo:","","","/////////","",""]' 54PASS segments('foo://///////bar.com/') is '["foo:","","","/////////bar.com/","",""]' 55PASS segments('foo:////://///') is '["foo:","","","////://///","",""]' 56PASS segments('c:/foo') is '["c:","","","/foo","",""]' 57PASS segments('//foo/bar') is '["http:","foo","","/bar","",""]' 58PASS segments('http://foo/path;a??e#f#g') is '["http:","foo","","/path;a","??e","#f#g"]' 59PASS segments('http://foo/abcd?efgh?ijkl') is '["http:","foo","","/abcd","?efgh?ijkl",""]' 60PASS segments('http://foo/abcd#foo?bar') is '["http:","foo","","/abcd","","#foo?bar"]' 61PASS segments('[61:24:74]:98') is '["http:","example.org","","/foo/[61:24:74]:98","",""]' 62FAIL segments('http://[61:27]:98') should be [":","","0","","",""]. Was ["http:","[61:27]","98","/","",""]. 63PASS segments('http:[61:27]/:foo') is '["http:","example.org","","/foo/[61:27]/:foo","",""]' 64PASS segments('http://[1::2]:3:4') is '[":","","","","",""]' 65PASS segments('http://2001::1') is '[":","","","","",""]' 66PASS segments('http://[2001::1') is '[":","","","","",""]' 67PASS segments('http://2001::1]') is '[":","","","","",""]' 68PASS segments('http://2001::1]:80') is '[":","","","","",""]' 69PASS segments('http://[2001::1]') is '["http:","[2001::1]","","/","",""]' 70PASS segments('http://[2001::1]:80') is '["http:","[2001::1]","","/","",""]' 71PASS segments('http://[[::]]') is '[":","","","","",""]' 72FAIL segments('http:/example.com/') should be ["http:","example.org","","/example.com/","",""]. Was ["http:","example.com","","/","",""]. 73PASS segments('ftp:/example.com/') is '["ftp:","example.com","","/","",""]' 74PASS segments('https:/example.com/') is '["https:","example.com","","/","",""]' 75PASS segments('madeupscheme:/example.com/') is '["madeupscheme:","","","/example.com/","",""]' 76PASS segments('file:/example.com/') is '["file:","","","/example.com/","",""]' 77PASS segments('ftps:/example.com/') is '["ftps:","","","/example.com/","",""]' 78PASS segments('gopher:/example.com/') is '["gopher:","example.com","","/","",""]' 79PASS segments('ws:/example.com/') is '["ws:","example.com","","/","",""]' 80PASS segments('wss:/example.com/') is '["wss:","example.com","","/","",""]' 81PASS segments('data:/example.com/') is '["data:","","","/example.com/","",""]' 82PASS segments('javascript:/example.com/') is '["javascript:","","","/example.com/","",""]' 83PASS segments('mailto:/example.com/') is '["mailto:","","","/example.com/","",""]' 84PASS segments('http:example.com/') is '["http:","example.org","","/foo/example.com/","",""]' 85PASS segments('ftp:example.com/') is '["ftp:","example.com","","/","",""]' 86PASS segments('https:example.com/') is '["https:","example.com","","/","",""]' 87PASS segments('madeupscheme:example.com/') is '["madeupscheme:","","","example.com/","",""]' 88FAIL segments('file:example.com/') should be ["file:","","","/example.com/","",""]. Was ["file:","","","example.com/","",""]. 89PASS segments('ftps:example.com/') is '["ftps:","","","example.com/","",""]' 90PASS segments('gopher:example.com/') is '["gopher:","example.com","","/","",""]' 91PASS segments('ws:example.com/') is '["ws:","example.com","","/","",""]' 92PASS segments('wss:example.com/') is '["wss:","example.com","","/","",""]' 93PASS segments('data:example.com/') is '["data:","","","example.com/","",""]' 94PASS segments('javascript:example.com/') is '["javascript:","","","example.com/","",""]' 95PASS segments('mailto:example.com/') is '["mailto:","","","example.com/","",""]' 96PASS segments('/a/b/c') is '["http:","example.org","","/a/b/c","",""]' 97PASS segments('/a/ /c') is '["http:","example.org","","/a/%20/c","",""]' 98PASS segments('/a%2fc') is '["http:","example.org","","/a%2fc","",""]' 99PASS segments('/a/%2f/c') is '["http:","example.org","","/a/%2f/c","",""]' 100FAIL segments('#β') should be ["http:","example.org","","/foo/bar","","#β"]. Was ["http:","example.org","","/foo/bar","","#%CE%B2"]. 101PASS successfullyParsed is true 102 103TEST COMPLETE 104 105