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","0","/foo/foo.com","",""]' 8PASS segments('\t :foo.com \n') is '["http:","example.org","0","/foo/:foo.com","",""]' 9PASS segments(' foo.com ') is '["http:","example.org","0","/foo/foo.com","",""]' 10PASS segments('a:\t foo.com') is '["a:","","0"," foo.com","",""]' 11FAIL segments('http://f:21/ b ? d # e ') should be ["http:","f","21","/%20b%20","?%20d%20","# e"]. Was ["http:","f","21","/ b ","?%20d%20","# e"]. 12PASS segments('http://f:/c') is '["http:","f","0","/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 '[":","","0","","",""]' 17PASS segments('http://f: /c') is '[":","","0","","",""]' 18PASS segments('http://f:\n/c') is '[":","","0","","",""]' 19PASS segments('http://f:fifty-two/c') is '[":","","0","","",""]' 20FAIL segments('http://f:999999/c') should be [":","","0","","",""]. Was ["http:","f","65535","/c","",""]. 21PASS segments('http://f: 21 / b ? d # e ') is '[":","","0","","",""]' 22PASS segments('') is '["http:","example.org","0","/foo/bar","",""]' 23PASS segments(' \t') is '["http:","example.org","0","/foo/bar","",""]' 24PASS segments(':foo.com/') is '["http:","example.org","0","/foo/:foo.com/","",""]' 25PASS segments(':foo.com\\') is '["http:","example.org","0","/foo/:foo.com/","",""]' 26PASS segments(':') is '["http:","example.org","0","/foo/:","",""]' 27PASS segments(':a') is '["http:","example.org","0","/foo/:a","",""]' 28PASS segments(':/') is '["http:","example.org","0","/foo/:/","",""]' 29PASS segments(':\\') is '["http:","example.org","0","/foo/:/","",""]' 30PASS segments(':#') is '["http:","example.org","0","/foo/:","",""]' 31PASS segments('#') is '["http:","example.org","0","/foo/bar","",""]' 32PASS segments('#/') is '["http:","example.org","0","/foo/bar","","#/"]' 33PASS segments('#\\') is '["http:","example.org","0","/foo/bar","","#\\\\"]' 34PASS segments('#;?') is '["http:","example.org","0","/foo/bar","","#;?"]' 35PASS segments('?') is '["http:","example.org","0","/foo/bar","",""]' 36PASS segments('/') is '["http:","example.org","0","/","",""]' 37PASS segments(':23') is '["http:","example.org","0","/foo/:23","",""]' 38PASS segments('/:23') is '["http:","example.org","0","/:23","",""]' 39FAIL segments('//') should be [":","","0","","",""]. Was ["http:","","0","/","",""]. 40PASS segments('::') is '["http:","example.org","0","/foo/::","",""]' 41PASS segments('::23') is '["http:","example.org","0","/foo/::23","",""]' 42PASS segments('foo://') is '["foo:","","0","//","",""]' 43PASS segments('http://a:b@c:29/d') is '["http:","c","29","/d","",""]' 44PASS segments('http::@c:29') is '["http:","example.org","0","/foo/:@c:29","",""]' 45FAIL segments('http://&a:foo(b]c@d:2/') should be ["http:","d","2","/","",""]. Was [":","","0","","",""]. 46FAIL segments('http://::@c@d:2') should be ["http:","d","2","/","",""]. Was [":","","0","","",""]. 47PASS segments('http://foo.com:b@d/') is '["http:","d","0","/","",""]' 48PASS segments('http://foo.com/\\@') is '["http:","foo.com","0","//@","",""]' 49PASS segments('http:\\\\foo.com\\') is '["http:","foo.com","0","/","",""]' 50PASS segments('http:\\\\a\\b:c\\d@foo.com\\') is '["http:","a","0","/b:c/d@foo.com/","",""]' 51PASS segments('foo:/') is '["foo:","","0","/","",""]' 52PASS segments('foo:/bar.com/') is '["foo:","","0","/bar.com/","",""]' 53PASS segments('foo://///////') is '["foo:","","0","/////////","",""]' 54PASS segments('foo://///////bar.com/') is '["foo:","","0","/////////bar.com/","",""]' 55PASS segments('foo:////://///') is '["foo:","","0","////://///","",""]' 56PASS segments('c:/foo') is '["c:","","0","/foo","",""]' 57PASS segments('//foo/bar') is '["http:","foo","0","/bar","",""]' 58PASS segments('http://foo/path;a??e#f#g') is '["http:","foo","0","/path;a","??e","#f#g"]' 59PASS segments('http://foo/abcd?efgh?ijkl') is '["http:","foo","0","/abcd","?efgh?ijkl",""]' 60PASS segments('http://foo/abcd#foo?bar') is '["http:","foo","0","/abcd","","#foo?bar"]' 61PASS segments('[61:24:74]:98') is '["http:","example.org","0","/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","0","/foo/[61:27]/:foo","",""]' 64PASS segments('http://[1::2]:3:4') is '[":","","0","","",""]' 65PASS segments('http://2001::1') is '[":","","0","","",""]' 66PASS segments('http://[2001::1') is '[":","","0","","",""]' 67PASS segments('http://2001::1]') is '[":","","0","","",""]' 68PASS segments('http://2001::1]:80') is '[":","","0","","",""]' 69PASS segments('http://[2001::1]') is '["http:","[2001::1]","0","/","",""]' 70PASS segments('http://[2001::1]:80') is '["http:","[2001::1]","0","/","",""]' 71PASS segments('http://[[::]]') is '[":","","0","","",""]' 72PASS successfullyParsed is true 73 74TEST COMPLETE 75 76