1description("Test URLs that have a port number.");
2
3cases = [
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
14for (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.
20shouldBe("canonicalize('foobar://www.example.com:80/')",
21         "'foobar://www.example.com:80/'");
22
23var successfullyParsed = true;
24