michael@0: function testBitOrInconvertibleObjectInconvertibleObject() michael@0: { michael@0: var count1 = 0; michael@0: function toString1() { ++count1; if (count1 == 95) return {}; return count1; } michael@0: var o1 = {valueOf: undefined, toString: toString1}; michael@0: var count2 = 0; michael@0: function toString2() { ++count2; if (count2 == 95) return {}; return count2; } michael@0: var o2 = {valueOf: undefined, toString: toString2}; 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 = o1 | o2; 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 !== 94) michael@0: return "expected q === 94, got " + q; michael@0: if (count1 !== 95) michael@0: return "expected count1 === 95, got " + count1; michael@0: if (count2 !== 94) michael@0: return "expected count2 === 94, got " + count2; michael@0: } michael@0: if (!threw) michael@0: return "expected throw with o1 | o2"; michael@0: michael@0: return "pass"; michael@0: } michael@0: assertEq(testBitOrInconvertibleObjectInconvertibleObject(), "pass");