mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 12:55:46 +00:00
Bug 576828: Test self-referential backreference. (r=dmandelin)
--HG-- extra : rebase_source : 42b9319d8e9c5ae48a04e8f9e099ee2ea8d93294
This commit is contained in:
parent
afa776f327
commit
1385ee75b6
@ -5,5 +5,6 @@ script 15.10.7.5-01.js
|
||||
script empty-lookahead.js
|
||||
script exec.js
|
||||
script exec-lastIndex-ToInteger.js
|
||||
script regress-576828.js
|
||||
skip-if(!xulRuntime.shell&&(Android||xulRuntime.OS=="WINNT")) script regress-617935.js
|
||||
script instance-property-storage-introspection.js
|
||||
|
8
js/src/tests/ecma_5/RegExp/regress-576828.js
Normal file
8
js/src/tests/ecma_5/RegExp/regress-576828.js
Normal file
@ -0,0 +1,8 @@
|
||||
var re = /(z\1){3}/;
|
||||
var str = 'zzz';
|
||||
var actual = re.exec(str);
|
||||
var expected = makeExpectedMatch(['zzz', 'z'], 0, str);
|
||||
checkRegExpMatch(actual, expected);
|
||||
|
||||
if (typeof reportCompare == 'function')
|
||||
reportCompare(true, true);
|
@ -0,0 +1,21 @@
|
||||
function makeExpectedMatch(arr, index, input) {
|
||||
var expectedMatch = {
|
||||
index: index,
|
||||
input: input,
|
||||
length: arr.length,
|
||||
};
|
||||
|
||||
for (var i = 0; i < arr.length; ++i)
|
||||
expectedMatch[i] = arr[i];
|
||||
|
||||
return expectedMatch;
|
||||
}
|
||||
|
||||
function checkRegExpMatch(actual, expected) {
|
||||
assertEq(actual.length, expected.length);
|
||||
for (var i = 0; i < actual.length; ++i)
|
||||
assertEq(actual[i], expected[i]);
|
||||
|
||||
assertEq(actual.index, expected.index);
|
||||
assertEq(actual.input, expected.input);
|
||||
}
|
Loading…
Reference in New Issue
Block a user