LibJS: Fix rest-params test to take function hoisting into account

This commit is contained in:
Marcin Gasperowicz 2020-06-04 18:56:45 +02:00 committed by Andreas Kling
parent 2579d0bf55
commit 0cbef87944
Notes: sideshowbarker 2024-07-19 05:48:37 +09:00

View file

@ -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);