| "Tests that defining a setter on the Array prototype and then using ArrayPush works even if it is done after arrays are allocated." |
| function foo(haveABadTime) { |
| for (var i = 0; i < 5; ++i) { |
| debug("Henceforth I will have a bad time."); |
| Array.prototype.__defineSetter__("3", function() { debug("Ouch!"); ouches++; }); |
| var expected = "\"0,1,2,3,4\""; |
| for (var i = 0; i < 1000; i = dfgIncrement({f:foo, i:i + 1, n:900})) { |
| expected = "\"0,1,2,,4\""; |
| shouldBe("\"" + foo(haveABadTime).join(",") + "\"", expected); |
| shouldBe("ouches", "50"); |