Home | History | Annotate | Download | only in url
      1 Test resolution of relative URLs.
      2 
      3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
      4 
      5 
      6 PASS canonicalize('http://another/') is 'http://another/'
      7 PASS canonicalize('http:////another/') is 'http://another/'
      8 PASS canonicalize('') is 'http://foo/bar'
      9 PASS canonicalize('') is 'http://foo/bar'
     10 PASS canonicalize('') is 'http://foo/bar'
     11 PASS canonicalize('  another  ') is 'http://foo/another'
     12 PASS canonicalize('  .  ') is 'http://foo/'
     13 PASS canonicalize(' 	 ') is 'http://foo/bar'
     14 PASS canonicalize('http:path') is 'http://host/path'
     15 PASS canonicalize('http:path') is 'http://host/a/path'
     16 FAIL canonicalize('http:/path') should be http://host/path. Was http://path/.
     17 FAIL canonicalize('HTTP:/path') should be http://host/path. Was http:/path.
     18 PASS canonicalize('https:host2') is 'https://host2/'
     19 PASS canonicalize('htto:/host2') is 'htto:/host2'
     20 PASS canonicalize('/b/c/d') is 'http://host/b/c/d'
     21 PASS canonicalize('\\b\\c\\d') is 'http://host/b/c/d'
     22 PASS canonicalize('/b/../c') is 'http://host/c'
     23 PASS canonicalize('/b/../c') is 'http://host/c'
     24 PASS canonicalize('\\b/../c?x#y') is 'http://host/c?x#y'
     25 PASS canonicalize('/b/../c?x#y') is 'http://host/c?x#y'
     26 PASS canonicalize('b') is 'http://host/b'
     27 PASS canonicalize('bc/de') is 'http://host/bc/de'
     28 PASS canonicalize('bc/de?query#ref') is 'http://host/a/bc/de?query#ref'
     29 PASS canonicalize('.') is 'http://host/a/'
     30 PASS canonicalize('..') is 'http://host/'
     31 PASS canonicalize('./..') is 'http://host/'
     32 PASS canonicalize('../.') is 'http://host/'
     33 PASS canonicalize('././.') is 'http://host/a/'
     34 PASS canonicalize('../../../foo') is 'http://host/foo'
     35 PASS canonicalize('?foo=bar') is 'http://host/a?foo=bar'
     36 PASS canonicalize('?') is 'http://host/a?'
     37 PASS canonicalize('?foo=bar#com') is 'http://host/a?foo=bar#com'
     38 PASS canonicalize('#ref') is 'http://host/a#ref'
     39 PASS canonicalize('#') is 'http://host/a#'
     40 PASS canonicalize('#bye') is 'http://host/a?foo=bar#bye'
     41 FAIL canonicalize('baz.html') should be . Was baz.html.
     42 PASS canonicalize('data:baz') is 'data:baz'
     43 PASS canonicalize('data:/base') is 'data:/base'
     44 PASS canonicalize('http://host/') is 'http://host/'
     45 PASS canonicalize('http:host') is 'http://host/'
     46 PASS canonicalize('./asd:fgh') is 'http://foo/asd:fgh'
     47 PASS canonicalize(':foo') is 'http://foo/:foo'
     48 PASS canonicalize(' hello world') is 'http://foo/hello%20world'
     49 FAIL canonicalize(':foo') should be . Was :foo.
     50 PASS canonicalize(';foo') is 'http://host/;foo'
     51 PASS canonicalize(';foo') is 'http://host/;foo'
     52 PASS canonicalize(';/../bar') is 'http://host/bar'
     53 PASS canonicalize('//another') is 'http://another/'
     54 PASS canonicalize('//another/path?query#ref') is 'http://another/path?query#ref'
     55 FAIL canonicalize('///another/path') should be http://another/path. Was http:/another/path.
     56 FAIL canonicalize('//Another\\path') should be http://another/path. Was http://Another/path.
     57 FAIL canonicalize('//') should be http:. Was http:/.
     58 PASS canonicalize('\\/another/path') is 'http://another/path'
     59 FAIL canonicalize('/\\Another\\path') should be http://another/path. Was http://Another/path.
     60 PASS successfullyParsed is true
     61 
     62 TEST COMPLETE
     63 
     64