new-1.js (314B)
1 // Some testing for JSOP_NEW. 2 function foo(prop) { 3 this.name = "Foo"; 4 this.prop = prop; 5 } 6 7 // Construct an object with a unique assignation to a property. 8 function f(i) { 9 var x = new foo(i); 10 return x.prop; 11 } 12 13 // Assert that a unique object really was created. 14 for (var i = 0; i < 100; i++) 15 assertEq(f(i), i);