michael@0: function f1(a, bIs, cIs, dIs, b=a, c=d, d=5) { michael@0: assertEq(a, 1); michael@0: assertEq(b, bIs); michael@0: assertEq(c, cIs); michael@0: assertEq(d, dIs); michael@0: } michael@0: f1(1, 1, undefined, 5); michael@0: f1(1, 42, undefined, 5, 42); michael@0: f1(1, 42, 43, 5, 42, 43); michael@0: f1(1, 42, 43, 44, 42, 43, 44); michael@0: function f2(a=[]) { return a; } michael@0: assertEq(f2() !== f2(), true); michael@0: function f3(a=function () {}) { return a; } michael@0: assertEq(f3() !== f3(), true); michael@0: function f4(a=Date) { return a; } michael@0: assertEq(f4(), Date); michael@0: Date = 0; michael@0: assertEq(f4(), 0); michael@0: function f5(x=FAIL()) {}; // don't throw michael@0: var n = 0; michael@0: function f6(a=n++) {} michael@0: assertEq(n, 0); michael@0: function f7([a, b], A=a, B=b) { michael@0: assertEq(A, a); michael@0: assertEq(B, b); michael@0: } michael@0: f7([0, 1]);