js/src/jit-test/tests/arguments/defaults-with-rest.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

michael@0 1 load(libdir + "eqArrayHelper.js");
michael@0 2
michael@0 3 function f1(a, bIs, b=3, ...rest) {
michael@0 4 assertEq(a, 1);
michael@0 5 assertEq(bIs, b);
michael@0 6 assertEqArray(rest, []);
michael@0 7 }
michael@0 8 assertEq(f1.length, 2);
michael@0 9 f1(1, 3);
michael@0 10 f1(1, 42, 42);
michael@0 11 function f2(a=rest, ...rest) {
michael@0 12 assertEq(a, undefined);
michael@0 13 }
michael@0 14 f2();
michael@0 15 function f3(a=rest, ...rest) {
michael@0 16 assertEq(a, 1);
michael@0 17 assertEqArray(rest, [2, 3, 4]);
michael@0 18 }
michael@0 19 f3(1, 2, 3, 4);
michael@0 20 function f4(a=42, ...f) {
michael@0 21 assertEq(typeof f, "function");
michael@0 22 function f() {}
michael@0 23 }
michael@0 24 f4()

mercurial