mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +00:00
LibJS: Fix rest-params test to take function hoisting into account
This commit is contained in:
parent
2579d0bf55
commit
0cbef87944
1 changed files with 6 additions and 6 deletions
|
@ -7,7 +7,7 @@ try {
|
||||||
}
|
}
|
||||||
foo();
|
foo();
|
||||||
|
|
||||||
function foo(...a) {
|
function foo1(...a) {
|
||||||
assert(a instanceof Array);
|
assert(a instanceof Array);
|
||||||
assert(a.length === 4);
|
assert(a.length === 4);
|
||||||
assert(a[0] === "foo");
|
assert(a[0] === "foo");
|
||||||
|
@ -15,17 +15,17 @@ try {
|
||||||
assert(a[2] === undefined);
|
assert(a[2] === undefined);
|
||||||
assert(a[3].foo === "bar");
|
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(a === "foo");
|
||||||
assert(b === 123);
|
assert(b === 123);
|
||||||
assert(c instanceof Array);
|
assert(c instanceof Array);
|
||||||
assert(c.length === 0);
|
assert(c.length === 0);
|
||||||
}
|
}
|
||||||
foo("foo", 123);
|
foo2("foo", 123);
|
||||||
|
|
||||||
function foo(a, b, ...c) {
|
function foo3(a, b, ...c) {
|
||||||
assert(a === "foo");
|
assert(a === "foo");
|
||||||
assert(b === 123);
|
assert(b === 123);
|
||||||
assert(c instanceof Array);
|
assert(c instanceof Array);
|
||||||
|
@ -33,7 +33,7 @@ try {
|
||||||
assert(c[0] === undefined);
|
assert(c[0] === undefined);
|
||||||
assert(c[1].foo === "bar");
|
assert(c[1].foo === "bar");
|
||||||
}
|
}
|
||||||
foo("foo", 123, undefined, { foo: "bar" });
|
foo3("foo", 123, undefined, { foo: "bar" });
|
||||||
|
|
||||||
var foo = (...a) => {
|
var foo = (...a) => {
|
||||||
assert(a instanceof Array);
|
assert(a instanceof Array);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue