Skip to content
Permalink
Browse files
2010-04-14 Adam Barth <abarth@webkit.org>
        Reviewed by Darin Fisher.

        Add port URL tests
        https://bugs.webkit.org/show_bug.cgi?id=37524

        This went pretty well.

        * fast/url/port-expected.txt: Added.
        * fast/url/port.html: Added.
        * fast/url/script-tests/port.js: Added.

Canonical link: https://commits.webkit.org/48876@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@57588 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eseidel committed Apr 14, 2010
1 parent fa2dc87 commit de2945d7014613169ba02b17b526732ec86da88b
Showing 4 changed files with 62 additions and 0 deletions.
@@ -1,3 +1,16 @@
2010-04-14 Adam Barth <abarth@webkit.org>

Reviewed by Darin Fisher.

Add port URL tests
https://bugs.webkit.org/show_bug.cgi?id=37524

This went pretty well.

* fast/url/port-expected.txt: Added.
* fast/url/port.html: Added.
* fast/url/script-tests/port.js: Added.

2010-04-14 Adam Barth <abarth@webkit.org>

Reviewed by Darin Fisher.
@@ -0,0 +1,14 @@
Test URLs that have a port number.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


FAIL canonicalize('http://www.example.com:as df/') should be http://www.example.com:as%20df/. Was http://www.example.com:as df/.
PASS canonicalize('http://www.example.com:-2/') is 'http://www.example.com:-2/'
FAIL canonicalize('http://www.example.com:80/') should be http://www.example.com/. Was http://www.example.com:80/.
PASS canonicalize('http://www.example.com:8080/') is 'http://www.example.com:8080/'
PASS canonicalize('foobar://www.example.com:80/') is 'foobar://www.example.com:80/'
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,14 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../js/resources/js-test-pre.js"></script>
<script src="resources/utilities.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="script-tests/port.js"></script>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>
@@ -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;

0 comments on commit de2945d

Please sign in to comment.