michael@0: function testAddInconvertibleObjectAny() michael@0: { michael@0: var count = 0; michael@0: function toString() michael@0: { michael@0: ++count; michael@0: if (count == 95) michael@0: return {}; michael@0: return "" + count; michael@0: } michael@0: var o = {valueOf: undefined, toString: toString}; michael@0: michael@0: var threw = false; michael@0: try michael@0: { michael@0: for (var i = 0; i < 100; i++) michael@0: var q = o + 5; michael@0: } michael@0: catch (e) michael@0: { michael@0: threw = true; michael@0: if (i !== 94) michael@0: return "expected i === 94, got " + i; michael@0: if (q !== "945") michael@0: return "expected q === '945', got " + q + " (type " + typeof q + ")"; michael@0: if (count !== 95) michael@0: return "expected count === 95, got " + count; michael@0: } michael@0: if (!threw) michael@0: return "expected throw with o + 5"; michael@0: michael@0: return "pass"; michael@0: } michael@0: assertEq(testAddInconvertibleObjectAny(), "pass");