Skip to content

Commit

Permalink
test: update url Web Platform Tests
Browse files Browse the repository at this point in the history
Update url tests to the latest upstream commit.

PR-URL: nodejs#38435
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
Leko committed Apr 29, 2021
1 parent 6ca785b commit 746cc88
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/fixtures/wpt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Last update:
- html/webappapis/timers: https://github.com/web-platform-tests/wpt/tree/5873f2d8f1/html/webappapis/timers
- interfaces: https://github.com/web-platform-tests/wpt/tree/79fa4cf76e/interfaces
- resources: https://github.com/web-platform-tests/wpt/tree/972ca5b669/resources
- url: https://github.com/web-platform-tests/wpt/tree/5eebfdb1f6/url
- url: https://github.com/web-platform-tests/wpt/tree/1439087f27/url

[Web Platform Tests]: https://github.com/web-platform-tests/wpt
[`git node wpt`]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md#git-node-wpt
114 changes: 114 additions & 0 deletions test/fixtures/wpt/url/resources/urltestdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -5945,6 +5945,120 @@
"search": "",
"hash": ""
},
"# Copy the host from the base URL in the following cases",
{
"input": "C|/",
"base": "file://host/",
"href": "file://host/C:/",
"protocol": "file:",
"username": "",
"password": "",
"host": "host",
"hostname": "host",
"port": "",
"pathname": "/C:/",
"search": "",
"hash": ""
},
{
"input": "/C:/",
"base": "file://host/",
"href": "file://host/C:/",
"protocol": "file:",
"username": "",
"password": "",
"host": "host",
"hostname": "host",
"port": "",
"pathname": "/C:/",
"search": "",
"hash": ""
},
{
"input": "file:C:/",
"base": "file://host/",
"href": "file://host/C:/",
"protocol": "file:",
"username": "",
"password": "",
"host": "host",
"hostname": "host",
"port": "",
"pathname": "/C:/",
"search": "",
"hash": ""
},
{
"input": "file:/C:/",
"base": "file://host/",
"href": "file://host/C:/",
"protocol": "file:",
"username": "",
"password": "",
"host": "host",
"hostname": "host",
"port": "",
"pathname": "/C:/",
"search": "",
"hash": ""
},
"# Copy the empty host from the input in the following cases",
{
"input": "//C:/",
"base": "file://host/",
"href": "file:///C:/",
"protocol": "file:",
"username": "",
"password": "",
"host": "",
"hostname": "",
"port": "",
"pathname": "/C:/",
"search": "",
"hash": ""
},
{
"input": "file://C:/",
"base": "file://host/",
"href": "file:///C:/",
"protocol": "file:",
"username": "",
"password": "",
"host": "",
"hostname": "",
"port": "",
"pathname": "/C:/",
"search": "",
"hash": ""
},
{
"input": "///C:/",
"base": "file://host/",
"href": "file:///C:/",
"protocol": "file:",
"username": "",
"password": "",
"host": "",
"hostname": "",
"port": "",
"pathname": "/C:/",
"search": "",
"hash": ""
},
{
"input": "file:///C:/",
"base": "file://host/",
"href": "file:///C:/",
"protocol": "file:",
"username": "",
"password": "",
"host": "",
"hostname": "",
"port": "",
"pathname": "/C:/",
"search": "",
"hash": ""
},
"# Windows drive letter quirk (no host)",
{
"input": "file:/C|/",
Expand Down
10 changes: 10 additions & 0 deletions test/fixtures/wpt/url/urlsearchparams-stringifier.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,13 @@ test(() => {
assert_equals(url.toString(), 'http://www.example.com/?a=b%2Cc&x=y');
assert_equals(params.toString(), 'a=b%2Cc&x=y');
}, 'URLSearchParams connected to URL');

test(() => {
const url = new URL('http://www.example.com/');
const params = url.searchParams;

params.append('a\nb', 'c\rd');
params.append('e\n\rf', 'g\r\nh');

assert_equals(params.toString(), "a%0Ab=c%0Dd&e%0A%0Df=g%0D%0Ah");
}, 'URLSearchParams must not do newline normalization');
2 changes: 1 addition & 1 deletion test/fixtures/wpt/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"path": "resources"
},
"url": {
"commit": "5eebfdb1f68059549b3efff380dd190bc6078266",
"commit": "1439087f27135b06deb70ffbf43e65ff64ff1ee6",
"path": "url"
}
}

0 comments on commit 746cc88

Please sign in to comment.