Bug 1744324 [wpt PR 31882] - URLPattern: Emit `{}` around custom names followed by a regexp group., a=testonly

Automatic update from web-platform-tests
URLPattern: Emit `{}` around custom names followed by a regexp group. (#31882)

This CL fixes another problem case from:

https://github.com/WICG/urlpattern/issues/145

In this case we need to preserve `{ ... }` braces around a named group
followed by a group that may be emitted in regexp `( ... )` group.  We
don't want `{:foo}(.*)` to be changed to `:foo(.*)` since that changes
the meaning from two groups to a single group.

Bug: 1263673
Change-Id: Ifc073d7bfb10f437180393b34cc3bf3c869d7f68
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3315419
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Ben Kelly <wanderview@chromium.org>
Cr-Commit-Position: refs/heads/main@{#949705}

Co-authored-by: Ben Kelly <wanderview@chromium.org>
--

wpt-commits: 938a88f9b3121e0f88bfce4baead83af93111cad
wpt-pr: 31882
This commit is contained in:
Blink WPT Bot 2021-12-09 16:19:01 +00:00 коммит произвёл moz-wptsync-bot
Родитель 3b2a4ebf4e
Коммит f4759fe55f
1 изменённых файлов: 62 добавлений и 0 удалений

Просмотреть файл

@ -2479,5 +2479,67 @@
"expected_match": {
"pathname": { "input": "foobarbaz", "groups": { "0": "foo", "1": "barbaz" }}
}
},
{
"pattern": [{ "pathname": "{:foo}(.*)" }],
"inputs": [{ "pathname": "foobarbaz" }],
"expected_match": {
"pathname": { "input": "foobarbaz", "groups": { "foo": "f", "0": "oobarbaz" }}
}
},
{
"pattern": [{ "pathname": "{:foo}(barbaz)" }],
"inputs": [{ "pathname": "foobarbaz" }],
"expected_match": {
"pathname": { "input": "foobarbaz", "groups": { "foo": "foo", "0": "barbaz" }}
}
},
{
"pattern": [{ "pathname": "{:foo}{(.*)}" }],
"inputs": [{ "pathname": "foobarbaz" }],
"expected_obj": {
"pathname": "{:foo}(.*)"
},
"expected_match": {
"pathname": { "input": "foobarbaz", "groups": { "foo": "f", "0": "oobarbaz" }}
}
},
{
"pattern": [{ "pathname": "{:foo}{(.*)bar}" }],
"inputs": [{ "pathname": "foobarbaz" }],
"expected_obj": {
"pathname": ":foo{(.*)bar}"
},
"expected_match": null
},
{
"pattern": [{ "pathname": "{:foo}{bar(.*)}" }],
"inputs": [{ "pathname": "foobarbaz" }],
"expected_obj": {
"pathname": ":foo{bar(.*)}"
},
"expected_match": {
"pathname": { "input": "foobarbaz", "groups": { "foo": "foo", "0": "baz" }}
}
},
{
"pattern": [{ "pathname": "{:foo}:bar(.*)" }],
"inputs": [{ "pathname": "foobarbaz" }],
"expected_obj": {
"pathname": ":foo:bar(.*)"
},
"expected_match": {
"pathname": { "input": "foobarbaz", "groups": { "foo": "f", "bar": "oobarbaz" }}
}
},
{
"pattern": [{ "pathname": "{:foo}?(.*)" }],
"inputs": [{ "pathname": "foobarbaz" }],
"expected_obj": {
"pathname": ":foo?*"
},
"expected_match": {
"pathname": { "input": "foobarbaz", "groups": { "foo": "f", "0": "oobarbaz" }}
}
}
]