Skip to content

Commit cfbc3d1

Browse files
anonriggithub-actions[bot]
authored andcommitted
test: update web platform tests
1 parent f1eee2a commit cfbc3d1

File tree

1 file changed

+80
-24
lines changed

1 file changed

+80
-24
lines changed

tests/wpt/urlpatterntestdata.json

+80-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
{
@@ -1139,13 +1145,6 @@
11391145
{
11401146
"pattern": [{ "protocol": "http", "port": "80 " }],
11411147
"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" }],
11491148
"expected_obj": "error"
11501149
},
11511150
{
@@ -1381,6 +1380,10 @@
13811380
"pathname": { "input": "8675309", "groups": { "number": "8675309" }}
13821381
}
13831382
},
1383+
{
1384+
"pattern": [{ "pathname": "/(\\m)" }],
1385+
"expected_obj": "error"
1386+
},
13841387
{
13851388
"pattern": [{ "pathname": "/foo!" }],
13861389
"inputs": [{ "pathname": "/foo!" }],
@@ -1803,6 +1806,11 @@
18031806
"pathname": { "input": "/foo", "groups": {} }
18041807
}
18051808
},
1809+
{
1810+
"pattern": [ "https://{sub.}?example{.com/}foo" ],
1811+
"inputs": [ "https://example.com/foo" ],
1812+
"expected_obj": "error"
1813+
},
18061814
{
18071815
"pattern": [ "{https://}example.com/foo" ],
18081816
"inputs": [ "https://example.com/foo" ],
@@ -1817,9 +1825,10 @@
18171825
"hostname": "(sub.)?example.com",
18181826
"pathname": "/foo"
18191827
},
1828+
"//": "The `null` below is translated to undefined in the test harness.",
18201829
"expected_match": {
18211830
"protocol": { "input": "https", "groups": {} },
1822-
"hostname": { "input": "example.com", "groups": {} },
1831+
"hostname": { "input": "example.com", "groups": { "0": null } },
18231832
"pathname": { "input": "/foo", "groups": {} }
18241833
}
18251834
},
@@ -1853,9 +1862,10 @@
18531862
"hostname": "(sub(?:.))?example.com",
18541863
"pathname": "/foo"
18551864
},
1865+
"//": "The `null` below is translated to undefined in the test harness.",
18561866
"expected_match": {
18571867
"protocol": { "input": "https", "groups": {} },
1858-
"hostname": { "input": "example.com", "groups": {} },
1868+
"hostname": { "input": "example.com", "groups": { "0": null } },
18591869
"pathname": { "input": "/foo", "groups": {} }
18601870
}
18611871
},
@@ -2287,9 +2297,10 @@
22872297
"protocol": "data",
22882298
"pathname": "text/javascript,let x = 100/:tens?5;"
22892299
},
2300+
"//": "The `null` below is translated to undefined in the test harness.",
22902301
"expected_match": {
22912302
"protocol": { "input": "data", "groups": {} },
2292-
"pathname": { "input": "text/javascript,let x = 100/5;", "groups": {} }
2303+
"pathname": { "input": "text/javascript,let x = 100/5;", "groups": { "tens": null } }
22932304
}
22942305
},
22952306
{
@@ -2356,21 +2367,15 @@
23562367
},
23572368
{
23582369
"pattern": [{ "hostname": "bad#hostname" }],
2359-
"inputs": [{ "hostname": "bad" }],
2360-
"expected_match": {
2361-
"hostname": { "input": "bad", "groups": {} }
2362-
}
2370+
"expected_obj": "error"
23632371
},
23642372
{
23652373
"pattern": [{ "hostname": "bad%hostname" }],
23662374
"expected_obj": "error"
23672375
},
23682376
{
23692377
"pattern": [{ "hostname": "bad/hostname" }],
2370-
"inputs": [{ "hostname": "bad" }],
2371-
"expected_match": {
2372-
"hostname": { "input": "bad", "groups": {} }
2373-
}
2378+
"expected_obj": "error"
23742379
},
23752380
{
23762381
"pattern": [{ "hostname": "bad\\:hostname" }],
@@ -2400,6 +2405,10 @@
24002405
"pattern": [{ "hostname": "bad]hostname" }],
24012406
"expected_obj": "error"
24022407
},
2408+
{
2409+
"pattern": [{ "hostname": "bad\\\\hostname" }],
2410+
"expected_obj": "error"
2411+
},
24032412
{
24042413
"pattern": [{ "hostname": "bad^hostname" }],
24052414
"expected_obj": "error"
@@ -2408,6 +2417,18 @@
24082417
"pattern": [{ "hostname": "bad|hostname" }],
24092418
"expected_obj": "error"
24102419
},
2420+
{
2421+
"pattern": [{ "hostname": "bad\nhostname" }],
2422+
"expected_obj": "error"
2423+
},
2424+
{
2425+
"pattern": [{ "hostname": "bad\rhostname" }],
2426+
"expected_obj": "error"
2427+
},
2428+
{
2429+
"pattern": [{ "hostname": "bad\thostname" }],
2430+
"expected_obj": "error"
2431+
},
24112432
{
24122433
"pattern": [{}],
24132434
"inputs": ["https://example.com/"],
@@ -2593,6 +2614,17 @@
25932614
"pathname": { "input": "foobar", "groups": { "foo": "foo" }}
25942615
}
25952616
},
2617+
{
2618+
"pattern": [{ "pathname": "*{}**?" }],
2619+
"inputs": [{ "pathname": "foobar" }],
2620+
"expected_obj": {
2621+
"pathname": "*(.*)?"
2622+
},
2623+
"//": "The `null` below is translated to undefined in the test harness.",
2624+
"expected_match": {
2625+
"pathname": { "input": "foobar", "groups": { "0": "foobar", "1": null }}
2626+
}
2627+
},
25962628
{
25972629
"pattern": [{ "pathname": ":foo(baz)(.*)" }],
25982630
"inputs": [{ "pathname": "bazbar" }],
@@ -2797,5 +2829,29 @@
27972829
"search": { "input": "q=*&v=?&hmm={}&umm=()", "groups": {} },
27982830
"hash": { "input": "foo", "groups": {} }
27992831
}
2832+
},
2833+
{
2834+
"pattern": [{ "pathname": "/([[a-z]--a])" }],
2835+
"inputs": [{ "pathname": "/a" }],
2836+
"expected_match": null
2837+
},
2838+
{
2839+
"pattern": [{ "pathname": "/([[a-z]--a])" }],
2840+
"inputs": [{ "pathname": "/z" }],
2841+
"expected_match": {
2842+
"pathname": { "input": "/z", "groups": { "0": "z" } }
2843+
}
2844+
},
2845+
{
2846+
"pattern": [{ "pathname": "/([\\d&&[0-1]])" }],
2847+
"inputs": [{ "pathname": "/0" }],
2848+
"expected_match": {
2849+
"pathname": { "input": "/0", "groups": { "0": "0" } }
2850+
}
2851+
},
2852+
{
2853+
"pattern": [{ "pathname": "/([\\d&&[0-1]])" }],
2854+
"inputs": [{ "pathname": "/3" }],
2855+
"expected_match": null
28002856
}
28012857
]

0 commit comments

Comments
 (0)