| OLD | NEW |
| (Empty) |
| 1 description( | |
| 2 "Tests that defining a setter on the prototype of an object used for indexed sto
rage works." | |
| 3 ); | |
| 4 | |
| 5 function Cons() { | |
| 6 } | |
| 7 | |
| 8 var ouches = 0; | |
| 9 Cons.prototype.__defineSetter__("3", function() { debug("Ouch!"); ouches++; }); | |
| 10 | |
| 11 function foo() { | |
| 12 var result = new Cons(); | |
| 13 result.length = 5; | |
| 14 for (var i = 0; i < result.length; ++i) | |
| 15 result[i] = i; | |
| 16 return result; | |
| 17 } | |
| 18 | |
| 19 for (var i = 0; i < 100; ++i) | |
| 20 shouldBe("\"" + Array.prototype.join.apply(foo(), [","]) + "\"", "\"0,1,2,,4
\""); | |
| 21 | |
| 22 shouldBe("ouches", "100"); | |
| OLD | NEW |