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