michael@0: function testNewString() michael@0: { michael@0: var o = { toString: function() { return "string"; } }; michael@0: var r = []; michael@0: for (var i = 0; i < 5; i++) michael@0: r.push(typeof new String(o)); michael@0: for (var i = 0; i < 5; i++) michael@0: r.push(typeof new String(3)); michael@0: for (var i = 0; i < 5; i++) michael@0: r.push(typeof new String(2.5)); michael@0: for (var i = 0; i < 5; i++) michael@0: r.push(typeof new String("string")); michael@0: for (var i = 0; i < 5; i++) michael@0: r.push(typeof new String(null)); michael@0: for (var i = 0; i < 5; i++) michael@0: r.push(typeof new String(true)); michael@0: for (var i = 0; i < 5; i++) michael@0: r.push(typeof new String(undefined)); michael@0: return r.length === 35 && r.every(function(v) { return v === "object"; }); michael@0: } michael@0: assertEq(testNewString(), true);