michael@0: function test1(i) { michael@0: var g1 = 20; michael@0: function g1() { michael@0: return 10; michael@0: } michael@0: assertEq(g1, 20); michael@0: michael@0: function g2(x) { michael@0: return x + 1; michael@0: } michael@0: return g2(i); michael@0: } michael@0: for (var i=0; i<100; i++) { michael@0: assertEq(test1(i), i + 1); michael@0: } michael@0: michael@0: var c = 0; michael@0: function test2(arr) { michael@0: for (var i=0; i<100; i++) { michael@0: arr.sort(function(a, b) { c += a + b; return 0; }); michael@0: } michael@0: return c; michael@0: } michael@0: test2([1, 2, 3]); michael@0: assertEq(c, 800);