summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_6/RegExp/split-invalid-lastIndex.js
blob: 3def559ad08ceeb0b3b5c1bdef2fce30d8755d75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var BUGNUMBER = 1263851;
var summary = "RegExp.prototype[@@split] should handle if lastIndex is out of bound.";

print(BUGNUMBER + ": " + summary);

var myRegExp = {
    get constructor() {
        return {
            get [Symbol.species]() {
                return function() {
                    return {
                        get lastIndex() {
                            return 9;
                        },
                        set lastIndex(v) {},
                        exec() {
                            return [];
                        }
                    };
                };
            }
        };
    }
};
var result = RegExp.prototype[Symbol.split].call(myRegExp, "abcde");;
assertEq(result.length, 2);
assertEq(result[0], "");
assertEq(result[1], "");

if (typeof reportCompare === "function")
    reportCompare(true, true);