1 description("Test for bug 31689: RegExp#exec's returned Array-like object behaves differently from regular Arrays");
4 [ /(a)(_)?.+(c)(_)?.+(e)(_)?.+/, 'abcdef', '["abcdef", "a", undefined, "c", undefined, "e", undefined]' ],
5 [ /(a)(_)?/, 'abcdef', '["a", "a", undefined]' ],
6 [ /(_)?.+(a)/, 'xabcdef', '["xa", undefined, "a"]' ],
7 [ /(_)?.+(a)(_)?/, 'xabcdef', '["xa", undefined, "a", undefined]' ],
10 function testRegExpMatchesArray(i)
12 return tests[i][0].exec(tests[i][1]);
15 function testInOperator(i)
20 matches = re.exec(str);
22 for (var j = 0; j < matches.length; j++) {
24 inArray.push(matches[j]);
30 function testForEachFunction(i)
35 matches = re.exec(str);
37 matches.forEach(function(m) {
44 for (var i in tests) {
45 shouldBe('testRegExpMatchesArray(' + i + ')', tests[i][2]);
46 shouldBe('testInOperator(' + i + ')', tests[i][2]);
47 shouldBe('testForEachFunction(' + i + ')', tests[i][2]);