mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
LibJS: Fix rest-params test to take function hoisting into account
This commit is contained in:
parent
2579d0bf55
commit
0cbef87944
Notes:
sideshowbarker
2024-07-19 05:48:37 +09:00
Author: https://github.com/nooga Commit: https://github.com/SerenityOS/serenity/commit/0cbef879447 Pull-request: https://github.com/SerenityOS/serenity/pull/2497
1 changed files with 6 additions and 6 deletions
|
@ -7,7 +7,7 @@ try {
|
|||
}
|
||||
foo();
|
||||
|
||||
function foo(...a) {
|
||||
function foo1(...a) {
|
||||
assert(a instanceof Array);
|
||||
assert(a.length === 4);
|
||||
assert(a[0] === "foo");
|
||||
|
@ -15,17 +15,17 @@ try {
|
|||
assert(a[2] === undefined);
|
||||
assert(a[3].foo === "bar");
|
||||
}
|
||||
foo("foo", 123, undefined, { foo: "bar" });
|
||||
foo1("foo", 123, undefined, { foo: "bar" });
|
||||
|
||||
function foo(a, b, ...c) {
|
||||
function foo2(a, b, ...c) {
|
||||
assert(a === "foo");
|
||||
assert(b === 123);
|
||||
assert(c instanceof Array);
|
||||
assert(c.length === 0);
|
||||
}
|
||||
foo("foo", 123);
|
||||
foo2("foo", 123);
|
||||
|
||||
function foo(a, b, ...c) {
|
||||
function foo3(a, b, ...c) {
|
||||
assert(a === "foo");
|
||||
assert(b === 123);
|
||||
assert(c instanceof Array);
|
||||
|
@ -33,7 +33,7 @@ try {
|
|||
assert(c[0] === undefined);
|
||||
assert(c[1].foo === "bar");
|
||||
}
|
||||
foo("foo", 123, undefined, { foo: "bar" });
|
||||
foo3("foo", 123, undefined, { foo: "bar" });
|
||||
|
||||
var foo = (...a) => {
|
||||
assert(a instanceof Array);
|
||||
|
|
Loading…
Add table
Reference in a new issue