Skip to content

Commit

Permalink
test: update web platform tests (#637)
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig authored Apr 28, 2024
1 parent 77bd12c commit 8b44147
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/wpt/setters_tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,17 @@
"port": ""
}
},
{
"comment": "Stuff after a ? delimiter is ignored, trailing 'port'",
"href": "http://example.net/path",
"new_value": "example.com?stuff:8080",
"expected": {
"href": "http://example.com/path",
"host": "example.com",
"hostname": "example.com",
"port": ""
}
},
{
"comment": "Stuff after a ? delimiter is ignored",
"href": "http://example.net/path",
Expand Down Expand Up @@ -924,6 +935,39 @@
"port": "8080"
}
},
{
"comment": "Anything other than ASCII digit stops the port parser in a setter but is not an error",
"href": "http://example.net:8080",
"new_value": "example.com:invalid",
"expected": {
"href": "http://example.com:8080/",
"host": "example.com:8080",
"hostname": "example.com",
"port": "8080"
}
},
{
"comment": "Anything other than ASCII digit stops the port parser in a setter but is not an error",
"href": "http://example.net:8080/test",
"new_value": "[::1]:invalid",
"expected": {
"href": "http://[::1]:8080/test",
"host": "[::1]:8080",
"hostname": "[::1]",
"port": "8080"
}
},
{
"comment": "IPv6 without port",
"href": "http://example.net:8080/test",
"new_value": "[::1]",
"expected": {
"href": "http://[::1]:8080/test",
"host": "[::1]:8080",
"hostname": "[::1]",
"port": "8080"
}
},
{
"comment": "Port numbers are 16 bit integers",
"href": "http://example.net/path",
Expand Down
58 changes: 58 additions & 0 deletions tests/wpt/urltestdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,36 @@
"search": "",
"hash": ""
},
{
"input": "http://a:b@c\\",
"base": null,
"href": "http://a:b@c/",
"origin": "http://c",
"protocol": "http:",
"username": "a",
"password": "b",
"host": "c",
"hostname": "c",
"port": "",
"pathname": "/",
"search": "",
"hash": ""
},
{
"input": "ws://a@b\\c",
"base": null,
"href": "ws://a@b/c",
"origin": "ws://b",
"protocol": "ws:",
"username": "a",
"password": "",
"host": "b",
"hostname": "b",
"port": "",
"pathname": "/c",
"search": "",
"hash": ""
},
{
"input": "foo:/",
"base": "http://example.org/foo/bar",
Expand Down Expand Up @@ -3560,6 +3590,34 @@
"search": "",
"hash": ""
},
{
"input": "file:.",
"base": null,
"href": "file:///",
"protocol": "file:",
"username": "",
"password": "",
"host": "",
"hostname": "",
"port": "",
"pathname": "/",
"search": "",
"hash": ""
},
{
"input": "file:.",
"base": "http://www.example.com/test",
"href": "file:///",
"protocol": "file:",
"username": "",
"password": "",
"host": "",
"hostname": "",
"port": "",
"pathname": "/",
"search": "",
"hash": ""
},
"# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/host.html",
"Basic canonicalization, uppercase should be converted to lowercase",
{
Expand Down

0 comments on commit 8b44147

Please sign in to comment.