summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_5/RegExp/shell.js
blob: 0ce9f087de91f9fdd9cd92f18ea091ca7ee348ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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);
}