From b2eb4211a5545a6a70570239b91c242642fbe4bb Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Thu, 19 Dec 2024 10:32:19 -0500 Subject: [PATCH 1/3] fix invalid urlpattern test --- urlpattern/resources/urlpatterntestdata.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/urlpattern/resources/urlpatterntestdata.json b/urlpattern/resources/urlpatterntestdata.json index 058079bb6d17ac..3acb8a7d1714e2 100644 --- a/urlpattern/resources/urlpatterntestdata.json +++ b/urlpattern/resources/urlpatterntestdata.json @@ -1145,7 +1145,10 @@ { "pattern": [{ "protocol": "http", "port": "80 " }], "inputs": [{ "protocol": "http", "port": "80" }], - "expected_obj": "error" + "exactly_empty_components": ["port"], + "expected_match": { + "protocol": { "input": "http", "groups": {} } + } }, { "pattern": [{ "port": "80" }], From 153c3e9369fcb670492fd2e6c91f44100763f381 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Thu, 19 Dec 2024 10:47:29 -0500 Subject: [PATCH 2/3] fix invalid urlpattern test validating hostname --- urlpattern/resources/urlpatterntestdata.json | 30 ++++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/urlpattern/resources/urlpatterntestdata.json b/urlpattern/resources/urlpatterntestdata.json index 3acb8a7d1714e2..57e3259c5592d9 100644 --- a/urlpattern/resources/urlpatterntestdata.json +++ b/urlpattern/resources/urlpatterntestdata.json @@ -2370,15 +2370,24 @@ }, { "pattern": [{ "hostname": "bad#hostname" }], - "expected_obj": "error" + "exactly_empty_components": ["port"], + "expected_match": { + "hostname": { "input": "bad", "groups": {} } + } }, { "pattern": [{ "hostname": "bad%hostname" }], - "expected_obj": "error" + "exactly_empty_components": ["port"], + "expected_match": { + "hostname": { "input": "bad%hostname", "groups": {} } + } }, { "pattern": [{ "hostname": "bad/hostname" }], - "expected_obj": "error" + "exactly_empty_components": ["port"], + "expected_match": { + "hostname": { "input": "bad", "groups": {} } + } }, { "pattern": [{ "hostname": "bad\\:hostname" }], @@ -2422,15 +2431,24 @@ }, { "pattern": [{ "hostname": "bad\nhostname" }], - "expected_obj": "error" + "exactly_empty_components": ["port"], + "expected_match": { + "hostname": { "input": "badhostname", "groups": {} } + } }, { "pattern": [{ "hostname": "bad\rhostname" }], - "expected_obj": "error" + "exactly_empty_components": ["port"], + "expected_match": { + "hostname": { "input": "badhostname", "groups": {} } + } }, { "pattern": [{ "hostname": "bad\thostname" }], - "expected_obj": "error" + "exactly_empty_components": ["port"], + "expected_match": { + "hostname": { "input": "badhostname", "groups": {} } + } }, { "pattern": [{}], From a8390b033f0748b9fade8cd5542982806f5bba49 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Thu, 19 Dec 2024 10:56:39 -0500 Subject: [PATCH 3/3] add invalid port test to urlpattern --- urlpattern/resources/urlpatterntestdata.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/urlpattern/resources/urlpatterntestdata.json b/urlpattern/resources/urlpatterntestdata.json index 57e3259c5592d9..03e5606368ce52 100644 --- a/urlpattern/resources/urlpatterntestdata.json +++ b/urlpattern/resources/urlpatterntestdata.json @@ -1150,6 +1150,11 @@ "protocol": { "input": "http", "groups": {} } } }, + { + "pattern": [{ "protocol": "http", "port": "100000" }], + "inputs": [{ "protocol": "http", "port": "100000" }], + "expected_obj": "error" + }, { "pattern": [{ "port": "80" }], "inputs": [{ "protocol": "http", "port": "80" }],