| OLD | NEW |
| 1 description("Test URL segmentation"); | 1 description("Test URL segmentation"); |
| 2 | 2 |
| 3 cases = [ | 3 cases = [ |
| 4 // [URL, [SCHEME, HOST, PORT, PATH, QUERY, REF]] | 4 // [URL, [SCHEME, HOST, PORT, PATH, QUERY, REF]] |
| 5 ["http://user:pass@foo:21/bar;par?b#c", ["http:","foo","21","/bar;par","?b"
,"#c"]], | 5 ["http://user:pass@foo:21/bar;par?b#c", ["http:","foo","21","/bar;par","?b"
,"#c"]], |
| 6 ["http:foo.com", ["http:","foo.com","","/","",""]], | 6 ["http:foo.com", ["http:","foo.com","","/","",""]], |
| 7 ["\\t :foo.com \\n", [":","","","","",""]], | 7 ["\\t :foo.com \\n", [":","","","","",""]], |
| 8 [" foo.com ", [":","","","","",""]], | 8 [" foo.com ", [":","","","","",""]], |
| 9 ["a:\\t foo.com", ["a:","",""," foo.com","",""]], | 9 ["a:\\t foo.com", ["a:","",""," foo.com","",""]], |
| 10 ["http://f:21/ b ? d # e ", ["http:","f","21","/%20b%20","?%20d
%20","# e"]], | 10 ["http://f:21/ b ? d # e ", ["http:","f","21","/%20b%20","?%20d
%20","# e"]], |
| 11 ["http://f:/c", ["http:","f","","/c","",""]], | 11 ["http://f:/c", ["http:","f","","/c","",""]], |
| 12 ["http://f:0/c", ["http:","f","0","/c","",""]], | 12 ["http://f:0/c", ["http:","f","0","/c","",""]], |
| 13 ["http://f:00000000000000/c", ["http:","f","0","/c","",""]], | 13 ["http://f:00000000000000/c", ["http:","f","0","/c","",""]], |
| 14 ["http://f:00000000000000000000080/c", ["http:","f","0","/c","",""]], | 14 ["http://f:00000000000000000000080/c", ["http:","f","0","/c","",""]], |
| 15 ["http://f:b/c", [":","","","","",""]], | 15 ["http://f:b/c", [":","","","","",""]], |
| 16 ["http://f: /c", [":","","","","",""]], | 16 ["http://f: /c", [":","","","","",""]], |
| 17 ["http://f:\\n/c", [":","","","","",""]], | 17 ["http://f:\\n/c", [":","","","","",""]], |
| 18 ["http://f:fifty-two/c", [":","","","","",""]], | 18 ["http://f:fifty-two/c", [":","","","","",""]], |
| 19 ["http://f:999999/c", [":","","0","","",""]], | 19 ["http://f:999999/c", [":","","0","","",""]], |
| 20 ["http://f: 21 / b ? d # e ", [":","","","","",""]], | 20 ["http://f: 21 / b ? d # e ", [":","","","","",""]], |
| 21 ["", ["data:","","","text/plain,baseURL"
,"",""]], | 21 ["", [":","","","","",""]], |
| 22 [" \\t", ["data:","","","text/plain,baseURL"
,"",""]], | 22 [" \\t", [":","","","","",""]], |
| 23 [":foo.com/", [":","","","","",""]], | 23 [":foo.com/", [":","","","","",""]], |
| 24 [":foo.com\\\\", [":","","","","",""]], | 24 [":foo.com\\\\", [":","","","","",""]], |
| 25 [":", [":","","","","",""]], | 25 [":", [":","","","","",""]], |
| 26 [":a", [":","","","","",""]], | 26 [":a", [":","","","","",""]], |
| 27 [":/", [":","","","","",""]], | 27 [":/", [":","","","","",""]], |
| 28 [":\\\\", [":","","","","",""]], | 28 [":\\\\", [":","","","","",""]], |
| 29 [":#", [":","","","","",""]], | 29 [":#", [":","","","","",""]], |
| 30 ["#", ["data:","","","text/plain,baseURL"
,"",""]], | 30 ["#", ["data:","","","text/plain,baseURL"
,"",""]], |
| 31 ["#/", ["data:","","","text/plain,baseURL"
,"","#/"]], | 31 ["#/", ["data:","","","text/plain,baseURL"
,"","#/"]], |
| 32 ["#\\\\", ["data:","","","text/plain,baseURL"
,"","#\\\\"]], | 32 ["#\\\\", ["data:","","","text/plain,baseURL"
,"","#\\\\"]], |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 var originalBaseURL = canonicalize("."); | 73 var originalBaseURL = canonicalize("."); |
| 74 setBaseURL("data:text/plain,baseURL"); | 74 setBaseURL("data:text/plain,baseURL"); |
| 75 | 75 |
| 76 for (var i = 0; i < cases.length; ++i) { | 76 for (var i = 0; i < cases.length; ++i) { |
| 77 shouldBe("segments('" + cases[i][0] + "')", | 77 shouldBe("segments('" + cases[i][0] + "')", |
| 78 "'" + JSON.stringify(cases[i][1]) + "'"); | 78 "'" + JSON.stringify(cases[i][1]) + "'"); |
| 79 } | 79 } |
| 80 | 80 |
| 81 setBaseURL(originalBaseURL); | 81 setBaseURL(originalBaseURL); |
| OLD | NEW |