Skip to content

Commit

Permalink
URL: URL.canParse()
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk authored and marcoscaceres committed Mar 28, 2023
1 parent dc47799 commit 3b9d07d
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions url/url-statics-canparse.any.js
Original file line number Diff line number Diff line change
@@ -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})`);
});

0 comments on commit 3b9d07d

Please sign in to comment.