michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: * michael@0: * Author: Geoffrey Sneddon michael@0: */ michael@0: michael@0: var BUGNUMBER = 646490; michael@0: var summary = michael@0: "RegExp.prototype.exec doesn't get the lastIndex and ToInteger() it for " + michael@0: "non-global regular expressions when it should"; michael@0: michael@0: print(BUGNUMBER + ": " + summary); michael@0: michael@0: /************** michael@0: * BEGIN TEST * michael@0: **************/ michael@0: michael@0: var re = /./, called = 0; michael@0: re.lastIndex = {valueOf: function() { called++; return 0; }}; michael@0: re.exec("."); michael@0: re.lastIndex = {toString: function() { called++; return "0"; }}; michael@0: re.exec("."); michael@0: re.lastIndex = { michael@0: valueOf: function() { called++; return 0; }, michael@0: toString: function() { called--; } michael@0: }; michael@0: re.exec("."); michael@0: assertEq(called, 3, "FAIL, got " + called); michael@0: michael@0: /******************************************************************************/ michael@0: michael@0: if (typeof reportCompare === "function") michael@0: reportCompare(true, true); michael@0: michael@0: print("All tests passed!");