summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/arguments/rest-basic.js
blob: cb050d13b35c3548d14f24da4bce90a20c82e77b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function check(expected, ...rest) {
    assertEq(expected.toString(), rest.toString());
}

assertEq(check.length, 1);
check([]);
check(['a', 'b'], 'a', 'b');
check(['a', 'b', 'c', 'd'], 'a', 'b', 'c', 'd');
check.apply(null, [['a', 'b'], 'a', 'b'])
check.call(null, ['a', 'b'], 'a', 'b')

var g = newGlobal();
g.eval("function f(...rest) { return rest; }");
var a = g.f(1, 2, 3);
assertEq(a instanceof g.Array, true);