Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5ecc1fb

Browse files
anonriggithub-actions[bot]
authored andcommittedFeb 18, 2025
test: update web platform tests
1 parent a8ce381 commit 5ecc1fb

File tree

1 file changed

+137
-24
lines changed

1 file changed

+137
-24
lines changed
 

‎tests/wpt/urlpatterntestdata.json

+137-24
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,9 @@
379379
{
380380
"pattern": [{ "pathname": "/foo/:bar?" }],
381381
"inputs": [{ "pathname": "/foo" }],
382+
"//": "The `null` below is translated to undefined in the test harness.",
382383
"expected_match": {
383-
"pathname": { "input": "/foo", "groups": {} }
384+
"pathname": { "input": "/foo", "groups": { "bar": null } }
384385
}
385386
},
386387
{
@@ -444,8 +445,9 @@
444445
{
445446
"pattern": [{ "pathname": "/foo/:bar*" }],
446447
"inputs": [{ "pathname": "/foo" }],
448+
"//": "The `null` below is translated to undefined in the test harness.",
447449
"expected_match": {
448-
"pathname": { "input": "/foo", "groups": {} }
450+
"pathname": { "input": "/foo", "groups": { "bar": null } }
449451
}
450452
},
451453
{
@@ -498,15 +500,17 @@
498500
"expected_obj": {
499501
"pathname": "/foo/*?"
500502
},
503+
"//": "The `null` below is translated to undefined in the test harness.",
501504
"expected_match": {
502-
"pathname": { "input": "/foo", "groups": {} }
505+
"pathname": { "input": "/foo", "groups": { "0": null } }
503506
}
504507
},
505508
{
506509
"pattern": [{ "pathname": "/foo/*?" }],
507510
"inputs": [{ "pathname": "/foo" }],
511+
"//": "The `null` below is translated to undefined in the test harness.",
508512
"expected_match": {
509-
"pathname": { "input": "/foo", "groups": {} }
513+
"pathname": { "input": "/foo", "groups": { "0": null } }
510514
}
511515
},
512516
{
@@ -682,15 +686,17 @@
682686
"expected_obj": {
683687
"pathname": "/foo/**"
684688
},
689+
"//": "The `null` below is translated to undefined in the test harness.",
685690
"expected_match": {
686-
"pathname": { "input": "/foo", "groups": {} }
691+
"pathname": { "input": "/foo", "groups": { "0": null } }
687692
}
688693
},
689694
{
690695
"pattern": [{ "pathname": "/foo/**" }],
691696
"inputs": [{ "pathname": "/foo" }],
697+
"//": "The `null` below is translated to undefined in the test harness.",
692698
"expected_match": {
693-
"pathname": { "input": "/foo", "groups": {} }
699+
"pathname": { "input": "/foo", "groups": { "0": null } }
694700
}
695701
},
696702
{
@@ -1115,6 +1121,63 @@
11151121
"hostname": { "input": "xn--caf-dma.com", "groups": {}}
11161122
}
11171123
},
1124+
{
1125+
"pattern": ["http://\uD83D\uDEB2.com/"],
1126+
"inputs": ["http://\uD83D\uDEB2.com/"],
1127+
"exactly_empty_components": [ "port" ],
1128+
"expected_obj": {
1129+
"protocol": "http",
1130+
"hostname": "xn--h78h.com",
1131+
"pathname": "/"
1132+
},
1133+
"expected_match": {
1134+
"protocol": { "input": "http", "groups": {}},
1135+
"hostname": { "input": "xn--h78h.com", "groups": {}},
1136+
"pathname": { "input": "/", "groups": {}}
1137+
}
1138+
},
1139+
{
1140+
"pattern": ["http://\uD83D \uDEB2"],
1141+
"expected_obj": "error"
1142+
},
1143+
{
1144+
"pattern": [{"hostname":"\uD83D \uDEB2"}],
1145+
"expected_obj": "error"
1146+
},
1147+
{
1148+
"pattern": [{"pathname":"\uD83D \uDEB2"}],
1149+
"inputs": [],
1150+
"expected_obj": {
1151+
"pathname": "%EF%BF%BD%20%EF%BF%BD"
1152+
},
1153+
"expected_match": null
1154+
},
1155+
{
1156+
"pattern": [{"pathname":":\uD83D \uDEB2"}],
1157+
"expected_obj": "error"
1158+
},
1159+
{
1160+
"pattern": [{"pathname":":a\uDB40\uDD00b"}],
1161+
"inputs": [],
1162+
"expected_obj": {
1163+
"pathname": ":a\uDB40\uDD00b"
1164+
},
1165+
"expected_match": null
1166+
},
1167+
{
1168+
"pattern": [{"pathname":"test/:a\uD801\uDC50b"}],
1169+
"inputs": [{"pathname":"test/foo"}],
1170+
"expected_obj": {
1171+
"pathname": "test/:a\uD801\uDC50b"
1172+
},
1173+
"expected_match": {
1174+
"pathname": { "input": "test/foo", "groups": { "a\uD801\uDC50b": "foo" }}
1175+
}
1176+
},
1177+
{
1178+
"pattern": [{"pathname":":\uD83D\uDEB2"}],
1179+
"expected_obj": "error"
1180+
},
11181181
{
11191182
"pattern": [{ "port": "" }],
11201183
"inputs": [{ "protocol": "http", "port": "80" }],
@@ -1139,13 +1202,6 @@
11391202
{
11401203
"pattern": [{ "protocol": "http", "port": "80 " }],
11411204
"inputs": [{ "protocol": "http", "port": "80" }],
1142-
"exactly_empty_components": ["port"],
1143-
"expected_match": {
1144-
"protocol": { "input": "http", "groups": {} }
1145-
}
1146-
},
1147-
{
1148-
"pattern": [{ "protocol": "http", "port": "100000" }],
11491205
"expected_obj": "error"
11501206
},
11511207
{
@@ -1381,6 +1437,10 @@
13811437
"pathname": { "input": "8675309", "groups": { "number": "8675309" }}
13821438
}
13831439
},
1440+
{
1441+
"pattern": [{ "pathname": "/(\\m)" }],
1442+
"expected_obj": "error"
1443+
},
13841444
{
13851445
"pattern": [{ "pathname": "/foo!" }],
13861446
"inputs": [{ "pathname": "/foo!" }],
@@ -1803,6 +1863,11 @@
18031863
"pathname": { "input": "/foo", "groups": {} }
18041864
}
18051865
},
1866+
{
1867+
"pattern": [ "https://{sub.}?example{.com/}foo" ],
1868+
"inputs": [ "https://example.com/foo" ],
1869+
"expected_obj": "error"
1870+
},
18061871
{
18071872
"pattern": [ "{https://}example.com/foo" ],
18081873
"inputs": [ "https://example.com/foo" ],
@@ -1817,9 +1882,10 @@
18171882
"hostname": "(sub.)?example.com",
18181883
"pathname": "/foo"
18191884
},
1885+
"//": "The `null` below is translated to undefined in the test harness.",
18201886
"expected_match": {
18211887
"protocol": { "input": "https", "groups": {} },
1822-
"hostname": { "input": "example.com", "groups": {} },
1888+
"hostname": { "input": "example.com", "groups": { "0": null } },
18231889
"pathname": { "input": "/foo", "groups": {} }
18241890
}
18251891
},
@@ -1853,9 +1919,10 @@
18531919
"hostname": "(sub(?:.))?example.com",
18541920
"pathname": "/foo"
18551921
},
1922+
"//": "The `null` below is translated to undefined in the test harness.",
18561923
"expected_match": {
18571924
"protocol": { "input": "https", "groups": {} },
1858-
"hostname": { "input": "example.com", "groups": {} },
1925+
"hostname": { "input": "example.com", "groups": { "0": null } },
18591926
"pathname": { "input": "/foo", "groups": {} }
18601927
}
18611928
},
@@ -2287,9 +2354,10 @@
22872354
"protocol": "data",
22882355
"pathname": "text/javascript,let x = 100/:tens?5;"
22892356
},
2357+
"//": "The `null` below is translated to undefined in the test harness.",
22902358
"expected_match": {
22912359
"protocol": { "input": "data", "groups": {} },
2292-
"pathname": { "input": "text/javascript,let x = 100/5;", "groups": {} }
2360+
"pathname": { "input": "text/javascript,let x = 100/5;", "groups": { "tens": null } }
22932361
}
22942362
},
22952363
{
@@ -2356,21 +2424,15 @@
23562424
},
23572425
{
23582426
"pattern": [{ "hostname": "bad#hostname" }],
2359-
"inputs": [{ "hostname": "bad" }],
2360-
"expected_match": {
2361-
"hostname": { "input": "bad", "groups": {} }
2362-
}
2427+
"expected_obj": "error"
23632428
},
23642429
{
23652430
"pattern": [{ "hostname": "bad%hostname" }],
23662431
"expected_obj": "error"
23672432
},
23682433
{
23692434
"pattern": [{ "hostname": "bad/hostname" }],
2370-
"inputs": [{ "hostname": "bad" }],
2371-
"expected_match": {
2372-
"hostname": { "input": "bad", "groups": {} }
2373-
}
2435+
"expected_obj": "error"
23742436
},
23752437
{
23762438
"pattern": [{ "hostname": "bad\\:hostname" }],
@@ -2400,6 +2462,10 @@
24002462
"pattern": [{ "hostname": "bad]hostname" }],
24012463
"expected_obj": "error"
24022464
},
2465+
{
2466+
"pattern": [{ "hostname": "bad\\\\hostname" }],
2467+
"expected_obj": "error"
2468+
},
24032469
{
24042470
"pattern": [{ "hostname": "bad^hostname" }],
24052471
"expected_obj": "error"
@@ -2408,6 +2474,18 @@
24082474
"pattern": [{ "hostname": "bad|hostname" }],
24092475
"expected_obj": "error"
24102476
},
2477+
{
2478+
"pattern": [{ "hostname": "bad\nhostname" }],
2479+
"expected_obj": "error"
2480+
},
2481+
{
2482+
"pattern": [{ "hostname": "bad\rhostname" }],
2483+
"expected_obj": "error"
2484+
},
2485+
{
2486+
"pattern": [{ "hostname": "bad\thostname" }],
2487+
"expected_obj": "error"
2488+
},
24112489
{
24122490
"pattern": [{}],
24132491
"inputs": ["https://example.com/"],
@@ -2593,6 +2671,17 @@
25932671
"pathname": { "input": "foobar", "groups": { "foo": "foo" }}
25942672
}
25952673
},
2674+
{
2675+
"pattern": [{ "pathname": "*{}**?" }],
2676+
"inputs": [{ "pathname": "foobar" }],
2677+
"expected_obj": {
2678+
"pathname": "*(.*)?"
2679+
},
2680+
"//": "The `null` below is translated to undefined in the test harness.",
2681+
"expected_match": {
2682+
"pathname": { "input": "foobar", "groups": { "0": "foobar", "1": null }}
2683+
}
2684+
},
25962685
{
25972686
"pattern": [{ "pathname": ":foo(baz)(.*)" }],
25982687
"inputs": [{ "pathname": "bazbar" }],
@@ -2797,5 +2886,29 @@
27972886
"search": { "input": "q=*&v=?&hmm={}&umm=()", "groups": {} },
27982887
"hash": { "input": "foo", "groups": {} }
27992888
}
2889+
},
2890+
{
2891+
"pattern": [{ "pathname": "/([[a-z]--a])" }],
2892+
"inputs": [{ "pathname": "/a" }],
2893+
"expected_match": null
2894+
},
2895+
{
2896+
"pattern": [{ "pathname": "/([[a-z]--a])" }],
2897+
"inputs": [{ "pathname": "/z" }],
2898+
"expected_match": {
2899+
"pathname": { "input": "/z", "groups": { "0": "z" } }
2900+
}
2901+
},
2902+
{
2903+
"pattern": [{ "pathname": "/([\\d&&[0-1]])" }],
2904+
"inputs": [{ "pathname": "/0" }],
2905+
"expected_match": {
2906+
"pathname": { "input": "/0", "groups": { "0": "0" } }
2907+
}
2908+
},
2909+
{
2910+
"pattern": [{ "pathname": "/([\\d&&[0-1]])" }],
2911+
"inputs": [{ "pathname": "/3" }],
2912+
"expected_match": null
28002913
}
28012914
]

0 commit comments

Comments
 (0)
Please sign in to comment.