mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:17:35 +00:00
LibWeb/Tests: Support URL tests with an input base
This commit is contained in:
parent
ef27750982
commit
791ad12031
2 changed files with 20 additions and 16 deletions
|
@ -1,4 +1,4 @@
|
||||||
ftp://serenityos.org:21
|
new URL('ftp://serenityos.org:21', undefined)
|
||||||
protocol => 'ftp:'
|
protocol => 'ftp:'
|
||||||
username => ''
|
username => ''
|
||||||
password => ''
|
password => ''
|
||||||
|
@ -8,7 +8,7 @@ port => ''
|
||||||
pathname => '/'
|
pathname => '/'
|
||||||
search => ''
|
search => ''
|
||||||
hash => ''
|
hash => ''
|
||||||
http://[0:1:0:1:0:1:0:1]
|
new URL('http://[0:1:0:1:0:1:0:1]', undefined)
|
||||||
protocol => 'http:'
|
protocol => 'http:'
|
||||||
username => ''
|
username => ''
|
||||||
password => ''
|
password => ''
|
||||||
|
@ -18,7 +18,7 @@ port => ''
|
||||||
pathname => '/'
|
pathname => '/'
|
||||||
search => ''
|
search => ''
|
||||||
hash => ''
|
hash => ''
|
||||||
http://[1:0:1:0:1:0:1:0]
|
new URL('http://[1:0:1:0:1:0:1:0]', undefined)
|
||||||
protocol => 'http:'
|
protocol => 'http:'
|
||||||
username => ''
|
username => ''
|
||||||
password => ''
|
password => ''
|
||||||
|
@ -28,7 +28,7 @@ port => ''
|
||||||
pathname => '/'
|
pathname => '/'
|
||||||
search => ''
|
search => ''
|
||||||
hash => ''
|
hash => ''
|
||||||
http://[1:1:0:0:1:0:0:0]/
|
new URL('http://[1:1:0:0:1:0:0:0]/', undefined)
|
||||||
protocol => 'http:'
|
protocol => 'http:'
|
||||||
username => ''
|
username => ''
|
||||||
password => ''
|
password => ''
|
||||||
|
@ -38,7 +38,7 @@ port => ''
|
||||||
pathname => '/'
|
pathname => '/'
|
||||||
search => ''
|
search => ''
|
||||||
hash => ''
|
hash => ''
|
||||||
unknown://serenityos.org:0
|
new URL('unknown://serenityos.org:0', undefined)
|
||||||
protocol => 'unknown:'
|
protocol => 'unknown:'
|
||||||
username => ''
|
username => ''
|
||||||
password => ''
|
password => ''
|
||||||
|
@ -48,7 +48,7 @@ port => '0'
|
||||||
pathname => ''
|
pathname => ''
|
||||||
search => ''
|
search => ''
|
||||||
hash => ''
|
hash => ''
|
||||||
http://serenityos.org/cat?dog#meow"woof
|
new URL('http://serenityos.org/cat?dog#meow"woof', undefined)
|
||||||
protocol => 'http:'
|
protocol => 'http:'
|
||||||
username => ''
|
username => ''
|
||||||
password => ''
|
password => ''
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
<script src="../include.js"></script>
|
<script src="../include.js"></script>
|
||||||
<script>
|
<script>
|
||||||
test(() => {
|
test(() => {
|
||||||
function printURL(input) {
|
function printURL(input, base) {
|
||||||
println(input);
|
if (base === undefined)
|
||||||
const url = new URL(input);
|
println(`new URL('${input}', ${base})`);
|
||||||
|
else
|
||||||
|
println(`new URL('${input}', '${base}')`);
|
||||||
|
|
||||||
|
const url = new URL(input, base);
|
||||||
println(`protocol => '${url.protocol}'`);
|
println(`protocol => '${url.protocol}'`);
|
||||||
println(`username => '${url.username}'`);
|
println(`username => '${url.username}'`);
|
||||||
println(`password => '${url.password}'`);
|
println(`password => '${url.password}'`);
|
||||||
|
@ -16,14 +20,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
for (url of [
|
for (url of [
|
||||||
'ftp://serenityos.org:21',
|
{ input: 'ftp://serenityos.org:21' },
|
||||||
'http://[0:1:0:1:0:1:0:1]',
|
{ input: 'http://[0:1:0:1:0:1:0:1]' },
|
||||||
'http://[1:0:1:0:1:0:1:0]',
|
{ input: 'http://[1:0:1:0:1:0:1:0]' },
|
||||||
'http://[1:1:0:0:1:0:0:0]/',
|
{ input: 'http://[1:1:0:0:1:0:0:0]/' },
|
||||||
'unknown://serenityos.org:0',
|
{ input: 'unknown://serenityos.org:0' },
|
||||||
'http://serenityos.org/cat?dog#meow"woof',
|
{ input: 'http://serenityos.org/cat?dog#meow"woof' },
|
||||||
]) {
|
]) {
|
||||||
printURL(url);
|
printURL(url.input, url.base);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue