michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: */ michael@0: michael@0: var BUGNUMBER = 501739; michael@0: var summary = michael@0: "String.prototype.match should zero the .lastIndex when called with a " + michael@0: "global RegExp"; michael@0: michael@0: print(BUGNUMBER + ": " + summary); michael@0: michael@0: /************** michael@0: * BEGIN TEST * michael@0: **************/ michael@0: michael@0: var s = '0x2x4x6x8'; michael@0: var p = /x/g; michael@0: p.lastIndex = 3; michael@0: michael@0: var arr = s.match(p); michael@0: assertEq(arr.length, 4); michael@0: arr.forEach(function(v) { assertEq(v, "x"); }); michael@0: assertEq(p.lastIndex, 0); michael@0: michael@0: /******************************************************************************/ michael@0: michael@0: if (typeof reportCompare === "function") michael@0: reportCompare(true, true); michael@0: michael@0: print("Tests complete");