Skip to content

Commit

Permalink
test: update web platform tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig authored and github-actions[bot] committed Jan 9, 2025
1 parent c9e2576 commit 80e4b0a
Showing 1 changed file with 80 additions and 24 deletions.
104 changes: 80 additions & 24 deletions tests/wpt/urlpatterntestdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,9 @@
{
"pattern": [{ "pathname": "/foo/:bar?" }],
"inputs": [{ "pathname": "/foo" }],
"//": "The `null` below is translated to undefined in the test harness.",
"expected_match": {
"pathname": { "input": "/foo", "groups": {} }
"pathname": { "input": "/foo", "groups": { "bar": null } }
}
},
{
Expand Down Expand Up @@ -444,8 +445,9 @@
{
"pattern": [{ "pathname": "/foo/:bar*" }],
"inputs": [{ "pathname": "/foo" }],
"//": "The `null` below is translated to undefined in the test harness.",
"expected_match": {
"pathname": { "input": "/foo", "groups": {} }
"pathname": { "input": "/foo", "groups": { "bar": null } }
}
},
{
Expand Down Expand Up @@ -498,15 +500,17 @@
"expected_obj": {
"pathname": "/foo/*?"
},
"//": "The `null` below is translated to undefined in the test harness.",
"expected_match": {
"pathname": { "input": "/foo", "groups": {} }
"pathname": { "input": "/foo", "groups": { "0": null } }
}
},
{
"pattern": [{ "pathname": "/foo/*?" }],
"inputs": [{ "pathname": "/foo" }],
"//": "The `null` below is translated to undefined in the test harness.",
"expected_match": {
"pathname": { "input": "/foo", "groups": {} }
"pathname": { "input": "/foo", "groups": { "0": null } }
}
},
{
Expand Down Expand Up @@ -682,15 +686,17 @@
"expected_obj": {
"pathname": "/foo/**"
},
"//": "The `null` below is translated to undefined in the test harness.",
"expected_match": {
"pathname": { "input": "/foo", "groups": {} }
"pathname": { "input": "/foo", "groups": { "0": null } }
}
},
{
"pattern": [{ "pathname": "/foo/**" }],
"inputs": [{ "pathname": "/foo" }],
"//": "The `null` below is translated to undefined in the test harness.",
"expected_match": {
"pathname": { "input": "/foo", "groups": {} }
"pathname": { "input": "/foo", "groups": { "0": null } }
}
},
{
Expand Down Expand Up @@ -1139,13 +1145,6 @@
{
"pattern": [{ "protocol": "http", "port": "80 " }],
"inputs": [{ "protocol": "http", "port": "80" }],
"exactly_empty_components": ["port"],
"expected_match": {
"protocol": { "input": "http", "groups": {} }
}
},
{
"pattern": [{ "protocol": "http", "port": "100000" }],
"expected_obj": "error"
},
{
Expand Down Expand Up @@ -1381,6 +1380,10 @@
"pathname": { "input": "8675309", "groups": { "number": "8675309" }}
}
},
{
"pattern": [{ "pathname": "/(\\m)" }],
"expected_obj": "error"
},
{
"pattern": [{ "pathname": "/foo!" }],
"inputs": [{ "pathname": "/foo!" }],
Expand Down Expand Up @@ -1803,6 +1806,11 @@
"pathname": { "input": "/foo", "groups": {} }
}
},
{
"pattern": [ "https://{sub.}?example{.com/}foo" ],
"inputs": [ "https://example.com/foo" ],
"expected_obj": "error"
},
{
"pattern": [ "{https://}example.com/foo" ],
"inputs": [ "https://example.com/foo" ],
Expand All @@ -1817,9 +1825,10 @@
"hostname": "(sub.)?example.com",
"pathname": "/foo"
},
"//": "The `null` below is translated to undefined in the test harness.",
"expected_match": {
"protocol": { "input": "https", "groups": {} },
"hostname": { "input": "example.com", "groups": {} },
"hostname": { "input": "example.com", "groups": { "0": null } },
"pathname": { "input": "/foo", "groups": {} }
}
},
Expand Down Expand Up @@ -1853,9 +1862,10 @@
"hostname": "(sub(?:.))?example.com",
"pathname": "/foo"
},
"//": "The `null` below is translated to undefined in the test harness.",
"expected_match": {
"protocol": { "input": "https", "groups": {} },
"hostname": { "input": "example.com", "groups": {} },
"hostname": { "input": "example.com", "groups": { "0": null } },
"pathname": { "input": "/foo", "groups": {} }
}
},
Expand Down Expand Up @@ -2287,9 +2297,10 @@
"protocol": "data",
"pathname": "text/javascript,let x = 100/:tens?5;"
},
"//": "The `null` below is translated to undefined in the test harness.",
"expected_match": {
"protocol": { "input": "data", "groups": {} },
"pathname": { "input": "text/javascript,let x = 100/5;", "groups": {} }
"pathname": { "input": "text/javascript,let x = 100/5;", "groups": { "tens": null } }
}
},
{
Expand Down Expand Up @@ -2356,21 +2367,15 @@
},
{
"pattern": [{ "hostname": "bad#hostname" }],
"inputs": [{ "hostname": "bad" }],
"expected_match": {
"hostname": { "input": "bad", "groups": {} }
}
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad%hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad/hostname" }],
"inputs": [{ "hostname": "bad" }],
"expected_match": {
"hostname": { "input": "bad", "groups": {} }
}
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad\\:hostname" }],
Expand Down Expand Up @@ -2400,6 +2405,10 @@
"pattern": [{ "hostname": "bad]hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad\\\\hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad^hostname" }],
"expected_obj": "error"
Expand All @@ -2408,6 +2417,18 @@
"pattern": [{ "hostname": "bad|hostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad\nhostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad\rhostname" }],
"expected_obj": "error"
},
{
"pattern": [{ "hostname": "bad\thostname" }],
"expected_obj": "error"
},
{
"pattern": [{}],
"inputs": ["https://example.com/"],
Expand Down Expand Up @@ -2593,6 +2614,17 @@
"pathname": { "input": "foobar", "groups": { "foo": "foo" }}
}
},
{
"pattern": [{ "pathname": "*{}**?" }],
"inputs": [{ "pathname": "foobar" }],
"expected_obj": {
"pathname": "*(.*)?"
},
"//": "The `null` below is translated to undefined in the test harness.",
"expected_match": {
"pathname": { "input": "foobar", "groups": { "0": "foobar", "1": null }}
}
},
{
"pattern": [{ "pathname": ":foo(baz)(.*)" }],
"inputs": [{ "pathname": "bazbar" }],
Expand Down Expand Up @@ -2797,5 +2829,29 @@
"search": { "input": "q=*&v=?&hmm={}&umm=()", "groups": {} },
"hash": { "input": "foo", "groups": {} }
}
},
{
"pattern": [{ "pathname": "/([[a-z]--a])" }],
"inputs": [{ "pathname": "/a" }],
"expected_match": null
},
{
"pattern": [{ "pathname": "/([[a-z]--a])" }],
"inputs": [{ "pathname": "/z" }],
"expected_match": {
"pathname": { "input": "/z", "groups": { "0": "z" } }
}
},
{
"pattern": [{ "pathname": "/([\\d&&[0-1]])" }],
"inputs": [{ "pathname": "/0" }],
"expected_match": {
"pathname": { "input": "/0", "groups": { "0": "0" } }
}
},
{
"pattern": [{ "pathname": "/([\\d&&[0-1]])" }],
"inputs": [{ "pathname": "/3" }],
"expected_match": null
}
]

0 comments on commit 80e4b0a

Please sign in to comment.