Skip to content

Commit 02c3623

Browse files
test: update WPT for url to 072413fba2
1 parent 26c4851 commit 02c3623

11 files changed

+326
-70
lines changed

test/fixtures/wpt/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Last update:
2828
- resource-timing: https://github.com/web-platform-tests/wpt/tree/22d38586d0/resource-timing
2929
- resources: https://github.com/web-platform-tests/wpt/tree/1e140d63ec/resources
3030
- streams: https://github.com/web-platform-tests/wpt/tree/bc9dcbbf1a/streams
31-
- url: https://github.com/web-platform-tests/wpt/tree/d86fcc9e87/url
31+
- url: https://github.com/web-platform-tests/wpt/tree/072413fba2/url
3232
- urlpattern: https://github.com/web-platform-tests/wpt/tree/827d52cc6e/urlpattern
3333
- user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing
3434
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
promise_test(() => fetch("resources/IdnaTestV2-removed.json").then(res => res.json()).then(runTests), "Loading data…");
2+
3+
function runTests(idnaTests) {
4+
for (const idnaTest of idnaTests) {
5+
if (typeof idnaTest === "string") {
6+
continue // skip comments
7+
}
8+
9+
test(() => {
10+
if (idnaTest.output === null) {
11+
assert_throws_js(TypeError, () => new URL(`https://${idnaTest.input}/x`));
12+
} else {
13+
const url = new URL(`https://${idnaTest.input}/x`);
14+
assert_equals(url.host, idnaTest.output);
15+
assert_equals(url.hostname, idnaTest.output);
16+
assert_equals(url.pathname, "/x");
17+
assert_equals(url.href, `https://${idnaTest.output}/x`);
18+
}
19+
}, `ToASCII("${idnaTest.input}")${idnaTest.comment ? " " + idnaTest.comment : ""}`);
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
[
2+
"This is generated with the help from ../tools/IdnaTestV2-compare.py.",
3+
"These tests are from an older IdnaTestV2 and thus the comment line may no longer be accurate.",
4+
{
5+
"comment": "P1; V6; V3 (ignored)",
6+
"input": "-\udb40\ude56\ua867\uff0e\udb40\ude82\ud8dc\udd83\ud83c\udd09",
7+
"output": null
8+
},
9+
{
10+
"comment": "P1; V5; V6",
11+
"input": "\ud83c\udd04\uff0e\u1cdc\u2488\u00df",
12+
"output": null
13+
},
14+
{
15+
"comment": "P1; V5; V6",
16+
"input": "\ud83c\udd04\uff0e\u1cdc\u2488SS",
17+
"output": null
18+
},
19+
{
20+
"comment": "P1; V5; V6",
21+
"input": "\ud83c\udd04\uff0e\u1cdc\u2488ss",
22+
"output": null
23+
},
24+
{
25+
"comment": "P1; V5; V6",
26+
"input": "\ud83c\udd04\uff0e\u1cdc\u2488Ss",
27+
"output": null
28+
},
29+
{
30+
"comment": "C2; P1; V6",
31+
"input": "\u0756\u3002\u3164\u200d\u03c2",
32+
"output": null
33+
},
34+
{
35+
"comment": "C2; P1; V6",
36+
"input": "\u0756\u3002\u1160\u200d\u03c2",
37+
"output": null
38+
},
39+
{
40+
"comment": "C2; P1; V6",
41+
"input": "\u0756\u3002\u1160\u200d\u03a3",
42+
"output": null
43+
},
44+
{
45+
"comment": "C2; P1; V6",
46+
"input": "\u0756\u3002\u1160\u200d\u03c3",
47+
"output": null
48+
},
49+
{
50+
"comment": "C2; P1; V6",
51+
"input": "\u0756\u3002\u3164\u200d\u03a3",
52+
"output": null
53+
},
54+
{
55+
"comment": "C2; P1; V6",
56+
"input": "\u0756\u3002\u3164\u200d\u03c3",
57+
"output": null
58+
},
59+
{
60+
"comment": "P1; V6",
61+
"input": "\ud83c\udd07\u4f10\ufe12.\ud831\ude5a\ua8c4",
62+
"output": null
63+
},
64+
{
65+
"comment": "P1; V5; V6",
66+
"input": "\ud802\ude3f.\ud83c\udd06\u2014",
67+
"output": null
68+
},
69+
{
70+
"comment": "C2; P1; V5; V6",
71+
"input": "\u1c32\ud83c\udd08\u2f9b\u05a6\uff0e\u200d\uda7e\udd64\u07fd",
72+
"output": null
73+
},
74+
{
75+
"comment": "C2; P1; V5; V6",
76+
"input": "\ud83e\udc9f\ud83c\udd08\u200d\ua84e\uff61\u0f84",
77+
"output": null
78+
},
79+
{
80+
"comment": "P1; V6",
81+
"input": "\udaa5\udeaa\uff61\ud83c\udd02",
82+
"output": null
83+
},
84+
{
85+
"comment": "C2; P1; V6",
86+
"input": "\u186f\u2689\u59f6\ud83c\udd09\uff0e\u06f7\u200d\ud83c\udfaa\u200d",
87+
"output": null
88+
},
89+
{
90+
"comment": "C1; P1; V5; V6",
91+
"input": "\ua67d\u200c\ud87e\uddf5\ud83c\udd06\uff61\u200c\ud804\udc42\u1b01",
92+
"output": null
93+
},
94+
{
95+
"comment": "C1; P1; V5; V6",
96+
"input": "\ua67d\u200c\u9723\ud83c\udd06\uff61\u200c\ud804\udc42\u1b01",
97+
"output": null
98+
},
99+
{
100+
"comment": "C1; P1; V5; V6; V3 (ignored)",
101+
"input": "-\u1897\u200c\ud83c\udd04.\ud805\udf22",
102+
"output": null
103+
}
104+
]

test/fixtures/wpt/url/resources/setters_tests.json

+16-16
Original file line numberDiff line numberDiff line change
@@ -2241,38 +2241,38 @@
22412241
}
22422242
},
22432243
{
2244-
"comment": "Drop trailing spaces from trailing opaque paths",
2244+
"comment": "Trailing spaces and opaque paths",
22452245
"href": "data:space ?query",
22462246
"new_value": "",
22472247
"expected": {
2248-
"href": "data:space",
2249-
"pathname": "space",
2248+
"href": "data:space%20",
2249+
"pathname": "space%20",
22502250
"search": ""
22512251
}
22522252
},
22532253
{
22542254
"href": "sc:space ?query",
22552255
"new_value": "",
22562256
"expected": {
2257-
"href": "sc:space",
2258-
"pathname": "space",
2257+
"href": "sc:space%20",
2258+
"pathname": "space%20",
22592259
"search": ""
22602260
}
22612261
},
22622262
{
2263-
"comment": "Do not drop trailing spaces from non-trailing opaque paths",
2263+
"comment": "Trailing spaces and opaque paths",
22642264
"href": "data:space ?query#fragment",
22652265
"new_value": "",
22662266
"expected": {
2267-
"href": "data:space #fragment",
2267+
"href": "data:space %20#fragment",
22682268
"search": ""
22692269
}
22702270
},
22712271
{
22722272
"href": "sc:space ?query#fragment",
22732273
"new_value": "",
22742274
"expected": {
2275-
"href": "sc:space #fragment",
2275+
"href": "sc:space %20#fragment",
22762276
"search": ""
22772277
}
22782278
},
@@ -2429,38 +2429,38 @@
24292429
}
24302430
},
24312431
{
2432-
"comment": "Drop trailing spaces from trailing opaque paths",
2432+
"comment": "Trailing spaces and opaque paths",
24332433
"href": "data:space #fragment",
24342434
"new_value": "",
24352435
"expected": {
2436-
"href": "data:space",
2437-
"pathname": "space",
2436+
"href": "data:space %20",
2437+
"pathname": "space %20",
24382438
"hash": ""
24392439
}
24402440
},
24412441
{
24422442
"href": "sc:space #fragment",
24432443
"new_value": "",
24442444
"expected": {
2445-
"href": "sc:space",
2446-
"pathname": "space",
2445+
"href": "sc:space %20",
2446+
"pathname": "space %20",
24472447
"hash": ""
24482448
}
24492449
},
24502450
{
2451-
"comment": "Do not drop trailing spaces from non-trailing opaque paths",
2451+
"comment": "Trailing spaces and opaque paths",
24522452
"href": "data:space ?query#fragment",
24532453
"new_value": "",
24542454
"expected": {
2455-
"href": "data:space ?query",
2455+
"href": "data:space %20?query",
24562456
"hash": ""
24572457
}
24582458
},
24592459
{
24602460
"href": "sc:space ?query#fragment",
24612461
"new_value": "",
24622462
"expected": {
2463-
"href": "sc:space ?query",
2463+
"href": "sc:space %20?query",
24642464
"hash": ""
24652465
}
24662466
},

test/fixtures/wpt/url/resources/toascii.json

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
[
22
"This contains assorted IDNA tests that IdnaTestV2 might not cover.",
33
"Feel free to deduplicate with a clear commit message.",
4+
"",
5+
"If the test only applies to the URL Standard's 'domain to ASCII', ",
6+
"and not to TR46's ToASCII, then tag it with `urlStandardOnly`",
47
{
58
"comment": "Label with hyphens in 3rd and 4th position",
69
"input": "aa--",
@@ -239,19 +242,22 @@
239242
},
240243
{
241244
"input": "www.lookout.net\u2A7480",
242-
"output": null
245+
"output": null,
246+
"urlStandardOnly": true
243247
},
244248
{
245249
"input": "www\u00A0.lookout.net",
246-
"output": null
250+
"output": null,
251+
"urlStandardOnly": true
247252
},
248253
{
249254
"input": "\u1680lookout.net",
250255
"output": null
251256
},
252257
{
253258
"input": "\u001flookout.net",
254-
"output": null
259+
"output": null,
260+
"urlStandardOnly": true
255261
},
256262
{
257263
"input": "look\u06DDout.net",

test/fixtures/wpt/url/resources/urltestdata.json

+120
Original file line numberDiff line numberDiff line change
@@ -3778,6 +3778,126 @@
37783778
"search": "",
37793779
"hash": ""
37803780
},
3781+
{
3782+
"input": "non-special:opaque ",
3783+
"base": null,
3784+
"href": "non-special:opaque",
3785+
"origin": "null",
3786+
"protocol": "non-special:",
3787+
"username": "",
3788+
"password": "",
3789+
"host": "",
3790+
"hostname": "",
3791+
"port": "",
3792+
"pathname": "opaque",
3793+
"search": "",
3794+
"hash": ""
3795+
},
3796+
{
3797+
"input": "non-special:opaque ?hi",
3798+
"base": null,
3799+
"href": "non-special:opaque %20?hi",
3800+
"origin": "null",
3801+
"protocol": "non-special:",
3802+
"username": "",
3803+
"password": "",
3804+
"host": "",
3805+
"hostname": "",
3806+
"port": "",
3807+
"pathname": "opaque %20",
3808+
"search": "?hi",
3809+
"hash": ""
3810+
},
3811+
{
3812+
"input": "non-special:opaque #hi",
3813+
"base": null,
3814+
"href": "non-special:opaque %20#hi",
3815+
"origin": "null",
3816+
"protocol": "non-special:",
3817+
"username": "",
3818+
"password": "",
3819+
"host": "",
3820+
"hostname": "",
3821+
"port": "",
3822+
"pathname": "opaque %20",
3823+
"search": "",
3824+
"hash": "#hi"
3825+
},
3826+
{
3827+
"input": "non-special:opaque x?hi",
3828+
"base": null,
3829+
"href": "non-special:opaque x?hi",
3830+
"origin": "null",
3831+
"protocol": "non-special:",
3832+
"username": "",
3833+
"password": "",
3834+
"host": "",
3835+
"hostname": "",
3836+
"port": "",
3837+
"pathname": "opaque x",
3838+
"search": "?hi",
3839+
"hash": ""
3840+
},
3841+
{
3842+
"input": "non-special:opaque x#hi",
3843+
"base": null,
3844+
"href": "non-special:opaque x#hi",
3845+
"origin": "null",
3846+
"protocol": "non-special:",
3847+
"username": "",
3848+
"password": "",
3849+
"host": "",
3850+
"hostname": "",
3851+
"port": "",
3852+
"pathname": "opaque x",
3853+
"search": "",
3854+
"hash": "#hi"
3855+
},
3856+
{
3857+
"input": "non-special:opaque \t\t \t#hi",
3858+
"base": null,
3859+
"href": "non-special:opaque %20#hi",
3860+
"origin": "null",
3861+
"protocol": "non-special:",
3862+
"username": "",
3863+
"password": "",
3864+
"host": "",
3865+
"hostname": "",
3866+
"port": "",
3867+
"pathname": "opaque %20",
3868+
"search": "",
3869+
"hash": "#hi"
3870+
},
3871+
{
3872+
"input": "non-special:opaque \t\t #hi",
3873+
"base": null,
3874+
"href": "non-special:opaque %20#hi",
3875+
"origin": "null",
3876+
"protocol": "non-special:",
3877+
"username": "",
3878+
"password": "",
3879+
"host": "",
3880+
"hostname": "",
3881+
"port": "",
3882+
"pathname": "opaque %20",
3883+
"search": "",
3884+
"hash": "#hi"
3885+
},
3886+
{
3887+
"input": "non-special:opaque\t\t \r #hi",
3888+
"base": null,
3889+
"href": "non-special:opaque %20#hi",
3890+
"origin": "null",
3891+
"protocol": "non-special:",
3892+
"username": "",
3893+
"password": "",
3894+
"host": "",
3895+
"hostname": "",
3896+
"port": "",
3897+
"pathname": "opaque %20",
3898+
"search": "",
3899+
"hash": "#hi"
3900+
},
37813901
"Ideographic full stop (full-width period for Chinese, etc.) should be treated as a dot. U+3002 is mapped to U+002E (dot)",
37823902
{
37833903
"input": "http://www.foo。bar.com",

0 commit comments

Comments
 (0)