From 3b9d07d9777d2a061660a9a51870b1671e060dcf Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Mon, 20 Mar 2023 10:13:08 +0100 Subject: [PATCH] URL: URL.canParse() For https://github.com/whatwg/url/pull/763. --- url/url-statics-canparse.any.js | 42 +++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 url/url-statics-canparse.any.js diff --git a/url/url-statics-canparse.any.js b/url/url-statics-canparse.any.js new file mode 100644 index 000000000000000..c87fcb4f56fcdd6 --- /dev/null +++ b/url/url-statics-canparse.any.js @@ -0,0 +1,42 @@ +// This intentionally does not use resources/urltestdata.json to preserve resources. +[ + { + "url": undefined, + "base": undefined, + "expected": false + }, + { + "url": "a:b", + "base": undefined, + "expected": true + }, + { + "url": undefined, + "base": "a:b", + "expected": false + }, + { + "url": "a:/b", + "base": undefined, + "expected": true + }, + { + "url": undefined, + "base": "a:/b", + "expected": true + }, + { + "url": "https://test:test", + "base": undefined, + "expected": false + }, + { + "url": "a", + "base": "https://b/", + "expected": true + } +].forEach(({ url, base, expected }) => { + test(() => { + assert_equals(URL.canParse(url, base), expected); + }, `URL.canParse(${url}, ${base})`); +});