Home | History | Annotate | Download | only in script-tests
      1 description("Test URLs that have a port number.");
      2 
      3 cases = [ 
      4   // Invalid input should be copied w/ failure.
      5   ["as df", ":as%20df"],
      6   ["-2", ":-2"],
      7   // Default port should be omitted.
      8   ["80", ""],
      9   ["8080", ":8080"],
     10   // Empty ports (just a colon) should also be removed
     11   ["", ""],
     12 ];
     13 
     14 for (var i = 0; i < cases.length; ++i) {
     15   shouldBe("canonicalize('http://www.example.com:" + cases[i][0] + "/')",
     16            "'http://www.example.com" + cases[i][1] + "/'");
     17 }
     18 
     19 // Unspecified port should mean always keep the port.
     20 shouldBe("canonicalize('foobar://www.example.com:80/')",
     21          "'foobar://www.example.com:80/'");
     22 
     23 var successfullyParsed = true;
     24