diff --git a/tests/wpt/urlpatterntestdata.json b/tests/wpt/urlpatterntestdata.json index 18a696d7f..058079bb6 100644 --- a/tests/wpt/urlpatterntestdata.json +++ b/tests/wpt/urlpatterntestdata.json @@ -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 } } } }, { @@ -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 } } } }, { @@ -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 } } } }, { @@ -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 } } } }, { @@ -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" }, { @@ -1381,6 +1380,10 @@ "pathname": { "input": "8675309", "groups": { "number": "8675309" }} } }, + { + "pattern": [{ "pathname": "/(\\m)" }], + "expected_obj": "error" + }, { "pattern": [{ "pathname": "/foo!" }], "inputs": [{ "pathname": "/foo!" }], @@ -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" ], @@ -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": {} } } }, @@ -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": {} } } }, @@ -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 } } } }, { @@ -2356,10 +2367,7 @@ }, { "pattern": [{ "hostname": "bad#hostname" }], - "inputs": [{ "hostname": "bad" }], - "expected_match": { - "hostname": { "input": "bad", "groups": {} } - } + "expected_obj": "error" }, { "pattern": [{ "hostname": "bad%hostname" }], @@ -2367,10 +2375,7 @@ }, { "pattern": [{ "hostname": "bad/hostname" }], - "inputs": [{ "hostname": "bad" }], - "expected_match": { - "hostname": { "input": "bad", "groups": {} } - } + "expected_obj": "error" }, { "pattern": [{ "hostname": "bad\\:hostname" }], @@ -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" @@ -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/"], @@ -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" }], @@ -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 } ]