1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/basic/testAddInconvertibleObjectAny.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,34 @@ 1.4 +function testAddInconvertibleObjectAny() 1.5 +{ 1.6 + var count = 0; 1.7 + function toString() 1.8 + { 1.9 + ++count; 1.10 + if (count == 95) 1.11 + return {}; 1.12 + return "" + count; 1.13 + } 1.14 + var o = {valueOf: undefined, toString: toString}; 1.15 + 1.16 + var threw = false; 1.17 + try 1.18 + { 1.19 + for (var i = 0; i < 100; i++) 1.20 + var q = o + 5; 1.21 + } 1.22 + catch (e) 1.23 + { 1.24 + threw = true; 1.25 + if (i !== 94) 1.26 + return "expected i === 94, got " + i; 1.27 + if (q !== "945") 1.28 + return "expected q === '945', got " + q + " (type " + typeof q + ")"; 1.29 + if (count !== 95) 1.30 + return "expected count === 95, got " + count; 1.31 + } 1.32 + if (!threw) 1.33 + return "expected throw with o + 5"; 1.34 + 1.35 + return "pass"; 1.36 +} 1.37 +assertEq(testAddInconvertibleObjectAny(), "pass");