summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/RegExp/replace-compile.js
blob: 45359037af8411e48e2b9c3abd98c3d9b7fff98d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var BUGNUMBER = 1287524;
var summary = 'RegExp.prototype[@@replace] should call replacer function after collecting all matches.';

print(BUGNUMBER + ": " + summary);

var rx = RegExp("a", "g");
var r = rx[Symbol.replace]("abba", function() {
    rx.compile("b", "g");
    return "?";
});
assertEq(r, "?bb?");

rx = RegExp("a", "g");
r = "abba".replace(rx, function() {
    rx.compile("b", "g");
    return "?";
});
assertEq(r, "?bb?");

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