summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/url/script-tests/port.js
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/fast/url/script-tests/port.js')
-rw-r--r--LayoutTests/fast/url/script-tests/port.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/LayoutTests/fast/url/script-tests/port.js b/LayoutTests/fast/url/script-tests/port.js
new file mode 100644
index 0000000..b3228b1
--- /dev/null
+++ b/LayoutTests/fast/url/script-tests/port.js
@@ -0,0 +1,21 @@
+description("Test URLs that have a port number.");
+
+cases = [
+ // Invalid input should be copied w/ failure.
+ ["as df", ":as%20df"],
+ ["-2", ":-2"],
+ // Default port should be omitted.
+ ["80", ""],
+ ["8080", ":8080"],
+];
+
+for (var i = 0; i < cases.length; ++i) {
+ shouldBe("canonicalize('http://www.example.com:" + cases[i][0] + "/')",
+ "'http://www.example.com" + cases[i][1] + "/'");
+}
+
+// Unspecified port should mean always keep the port.
+shouldBe("canonicalize('foobar://www.example.com:80/')",
+ "'foobar://www.example.com:80/'");
+
+var successfullyParsed = true;