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