forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1886727 [wpt PR 45248] - URL: tests for URL.parse(), a=testonly
Automatic update from web-platform-tests URL: tests for URL.parse() For whatwg/url#825. -- wpt-commits: 0f550ab9f5a07ed293926a306e914866164b346b wpt-pr: 45248
- Loading branch information
1 parent
8ce9b93
commit c0b48cf
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// This intentionally does not use resources/urltestdata.json to preserve resources. | ||
[ | ||
{ | ||
"url": undefined, | ||
"base": undefined, | ||
"expected": false | ||
}, | ||
{ | ||
"url": "aaa:b", | ||
"base": undefined, | ||
"expected": true | ||
}, | ||
{ | ||
"url": undefined, | ||
"base": "aaa:b", | ||
"expected": false | ||
}, | ||
{ | ||
"url": "aaa:/b", | ||
"base": undefined, | ||
"expected": true | ||
}, | ||
{ | ||
"url": undefined, | ||
"base": "aaa:/b", | ||
"expected": true | ||
}, | ||
{ | ||
"url": "https://test:test", | ||
"base": undefined, | ||
"expected": false | ||
}, | ||
{ | ||
"url": "a", | ||
"base": "https://b/", | ||
"expected": true | ||
} | ||
].forEach(({ url, base, expected }) => { | ||
test(() => { | ||
if (expected == false) { | ||
assert_equals(URL.parse(url, base), null); | ||
} else { | ||
assert_equals(URL.parse(url, base).href, new URL(url, base).href); | ||
} | ||
}, `URL.parse(${url}, ${base})`); | ||
}); | ||
|
||
test(() => { | ||
assert_not_equals(URL.parse("https://example/"), URL.parse("https://example/")); | ||
}, `URL.parse() should return a unique object`); |