Skip to content

Commit 22a725c

Browse files
committed
test: update web platform tests
1 parent 7e1594b commit 22a725c

File tree

1 file changed

+116
-10
lines changed

1 file changed

+116
-10
lines changed

tests/wpt/urlpatterntestdata.json

Lines changed: 116 additions & 10 deletions
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,41 @@
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+
},
11181159
{
11191160
"pattern": [{"pathname":":a\uDB40\uDD00b"}],
11201161
"inputs": [],
@@ -1404,6 +1445,10 @@
14041445
"pathname": { "input": "8675309", "groups": { "number": "8675309" }}
14051446
}
14061447
},
1448+
{
1449+
"pattern": [{ "pathname": "/(\\m)" }],
1450+
"expected_obj": "error"
1451+
},
14071452
{
14081453
"pattern": [{ "pathname": "/foo!" }],
14091454
"inputs": [{ "pathname": "/foo!" }],
@@ -1826,6 +1871,11 @@
18261871
"pathname": { "input": "/foo", "groups": {} }
18271872
}
18281873
},
1874+
{
1875+
"pattern": [ "https://{sub.}?example{.com/}foo" ],
1876+
"inputs": [ "https://example.com/foo" ],
1877+
"expected_obj": "error"
1878+
},
18291879
{
18301880
"pattern": [ "{https://}example.com/foo" ],
18311881
"inputs": [ "https://example.com/foo" ],
@@ -1840,9 +1890,10 @@
18401890
"hostname": "(sub.)?example.com",
18411891
"pathname": "/foo"
18421892
},
1893+
"//": "The `null` below is translated to undefined in the test harness.",
18431894
"expected_match": {
18441895
"protocol": { "input": "https", "groups": {} },
1845-
"hostname": { "input": "example.com", "groups": {} },
1896+
"hostname": { "input": "example.com", "groups": { "0": null } },
18461897
"pathname": { "input": "/foo", "groups": {} }
18471898
}
18481899
},
@@ -1876,9 +1927,10 @@
18761927
"hostname": "(sub(?:.))?example.com",
18771928
"pathname": "/foo"
18781929
},
1930+
"//": "The `null` below is translated to undefined in the test harness.",
18791931
"expected_match": {
18801932
"protocol": { "input": "https", "groups": {} },
1881-
"hostname": { "input": "example.com", "groups": {} },
1933+
"hostname": { "input": "example.com", "groups": { "0": null } },
18821934
"pathname": { "input": "/foo", "groups": {} }
18831935
}
18841936
},
@@ -2310,9 +2362,10 @@
23102362
"protocol": "data",
23112363
"pathname": "text/javascript,let x = 100/:tens?5;"
23122364
},
2365+
"//": "The `null` below is translated to undefined in the test harness.",
23132366
"expected_match": {
23142367
"protocol": { "input": "data", "groups": {} },
2315-
"pathname": { "input": "text/javascript,let x = 100/5;", "groups": {} }
2368+
"pathname": { "input": "text/javascript,let x = 100/5;", "groups": { "tens": null } }
23162369
}
23172370
},
23182371
{
@@ -2379,7 +2432,10 @@
23792432
},
23802433
{
23812434
"pattern": [{ "hostname": "bad#hostname" }],
2382-
"inputs": [{ "hostname": "bad" }],
2435+
"inputs": [{ "hostname": "bad" }],
2436+
"expected_obj": {
2437+
"hostname": "bad"
2438+
},
23832439
"expected_match": {
23842440
"hostname": { "input": "bad", "groups": {} }
23852441
}
@@ -2391,6 +2447,9 @@
23912447
{
23922448
"pattern": [{ "hostname": "bad/hostname" }],
23932449
"inputs": [{ "hostname": "bad" }],
2450+
"expected_obj": {
2451+
"hostname": "bad"
2452+
},
23942453
"expected_match": {
23952454
"hostname": { "input": "bad", "groups": {} }
23962455
}
@@ -2426,6 +2485,9 @@
24262485
{
24272486
"pattern": [{ "hostname": "bad\\\\hostname" }],
24282487
"inputs": [{ "hostname": "badhostname" }],
2488+
"expected_obj": {
2489+
"hostname": "bad"
2490+
},
24292491
"expected_match": null
24302492
},
24312493
{
@@ -2439,20 +2501,29 @@
24392501
{
24402502
"pattern": [{ "hostname": "bad\nhostname" }],
24412503
"inputs": [{ "hostname": "badhostname" }],
2504+
"expected_obj": {
2505+
"hostname": "badhostname"
2506+
},
24422507
"expected_match": {
24432508
"hostname": { "input": "badhostname", "groups": {} }
24442509
}
24452510
},
24462511
{
24472512
"pattern": [{ "hostname": "bad\rhostname" }],
24482513
"inputs": [{ "hostname": "badhostname" }],
2514+
"expected_obj": {
2515+
"hostname": "badhostname"
2516+
},
24492517
"expected_match": {
24502518
"hostname": { "input": "badhostname", "groups": {} }
24512519
}
24522520
},
24532521
{
24542522
"pattern": [{ "hostname": "bad\thostname" }],
24552523
"inputs": [{ "hostname": "badhostname" }],
2524+
"expected_obj": {
2525+
"hostname": "badhostname"
2526+
},
24562527
"expected_match": {
24572528
"hostname": { "input": "badhostname", "groups": {} }
24582529
}
@@ -2642,6 +2713,17 @@
26422713
"pathname": { "input": "foobar", "groups": { "foo": "foo" }}
26432714
}
26442715
},
2716+
{
2717+
"pattern": [{ "pathname": "*{}**?" }],
2718+
"inputs": [{ "pathname": "foobar" }],
2719+
"expected_obj": {
2720+
"pathname": "*(.*)?"
2721+
},
2722+
"//": "The `null` below is translated to undefined in the test harness.",
2723+
"expected_match": {
2724+
"pathname": { "input": "foobar", "groups": { "0": "foobar", "1": null }}
2725+
}
2726+
},
26452727
{
26462728
"pattern": [{ "pathname": ":foo(baz)(.*)" }],
26472729
"inputs": [{ "pathname": "bazbar" }],
@@ -2846,5 +2928,29 @@
28462928
"search": { "input": "q=*&v=?&hmm={}&umm=()", "groups": {} },
28472929
"hash": { "input": "foo", "groups": {} }
28482930
}
2931+
},
2932+
{
2933+
"pattern": [{ "pathname": "/([[a-z]--a])" }],
2934+
"inputs": [{ "pathname": "/a" }],
2935+
"expected_match": null
2936+
},
2937+
{
2938+
"pattern": [{ "pathname": "/([[a-z]--a])" }],
2939+
"inputs": [{ "pathname": "/z" }],
2940+
"expected_match": {
2941+
"pathname": { "input": "/z", "groups": { "0": "z" } }
2942+
}
2943+
},
2944+
{
2945+
"pattern": [{ "pathname": "/([\\d&&[0-1]])" }],
2946+
"inputs": [{ "pathname": "/0" }],
2947+
"expected_match": {
2948+
"pathname": { "input": "/0", "groups": { "0": "0" } }
2949+
}
2950+
},
2951+
{
2952+
"pattern": [{ "pathname": "/([\\d&&[0-1]])" }],
2953+
"inputs": [{ "pathname": "/3" }],
2954+
"expected_match": null
28492955
}
28502956
]

0 commit comments

Comments
 (0)