Skip to content

Commit ae2959e

Browse files
authored
Fix invalid URLPattern tests
1 parent e53d223 commit ae2959e

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

urlpattern/resources/urlpatterntestdata.json

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,14 @@
12021202
{
12031203
"pattern": [{ "protocol": "http", "port": "80 " }],
12041204
"inputs": [{ "protocol": "http", "port": "80" }],
1205+
"exactly_empty_components": ["port"],
1206+
"expected_match": {
1207+
"protocol": { "input": "http", "groups": {} }
1208+
}
1209+
},
1210+
{
1211+
"pattern": [{ "protocol": "http", "port": "100000" }],
1212+
"inputs": [{ "protocol": "http", "port": "100000" }],
12051213
"expected_obj": "error"
12061214
},
12071215
{
@@ -2424,15 +2432,24 @@
24242432
},
24252433
{
24262434
"pattern": [{ "hostname": "bad#hostname" }],
2427-
"expected_obj": "error"
2435+
"exactly_empty_components": ["port"],
2436+
"expected_match": {
2437+
"hostname": { "input": "bad", "groups": {} }
2438+
}
24282439
},
24292440
{
24302441
"pattern": [{ "hostname": "bad%hostname" }],
2431-
"expected_obj": "error"
2442+
"exactly_empty_components": ["port"],
2443+
"expected_match": {
2444+
"hostname": { "input": "bad%hostname", "groups": {} }
2445+
}
24322446
},
24332447
{
24342448
"pattern": [{ "hostname": "bad/hostname" }],
2435-
"expected_obj": "error"
2449+
"exactly_empty_components": ["port"],
2450+
"expected_match": {
2451+
"hostname": { "input": "bad", "groups": {} }
2452+
}
24362453
},
24372454
{
24382455
"pattern": [{ "hostname": "bad\\:hostname" }],
@@ -2476,15 +2493,24 @@
24762493
},
24772494
{
24782495
"pattern": [{ "hostname": "bad\nhostname" }],
2479-
"expected_obj": "error"
2496+
"exactly_empty_components": ["port"],
2497+
"expected_match": {
2498+
"hostname": { "input": "badhostname", "groups": {} }
2499+
}
24802500
},
24812501
{
24822502
"pattern": [{ "hostname": "bad\rhostname" }],
2483-
"expected_obj": "error"
2503+
"exactly_empty_components": ["port"],
2504+
"expected_match": {
2505+
"hostname": { "input": "badhostname", "groups": {} }
2506+
}
24842507
},
24852508
{
24862509
"pattern": [{ "hostname": "bad\thostname" }],
2487-
"expected_obj": "error"
2510+
"exactly_empty_components": ["port"],
2511+
"expected_match": {
2512+
"hostname": { "input": "badhostname", "groups": {} }
2513+
}
24882514
},
24892515
{
24902516
"pattern": [{}],

0 commit comments

Comments
 (0)