js/src/jit-test/tests/arguments/rest-basic.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/arguments/rest-basic.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,15 @@
     1.4 +function check(expected, ...rest) {
     1.5 +    assertEq(expected.toString(), rest.toString());
     1.6 +}
     1.7 +
     1.8 +assertEq(check.length, 1);
     1.9 +check([]);
    1.10 +check(['a', 'b'], 'a', 'b');
    1.11 +check(['a', 'b', 'c', 'd'], 'a', 'b', 'c', 'd');
    1.12 +check.apply(null, [['a', 'b'], 'a', 'b'])
    1.13 +check.call(null, ['a', 'b'], 'a', 'b')
    1.14 +
    1.15 +var g = newGlobal();
    1.16 +g.eval("function f(...rest) { return rest; }");
    1.17 +var a = g.f(1, 2, 3);
    1.18 +assertEq(a instanceof g.Array, true);
    1.19 \ No newline at end of file

mercurial