summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/String/replace.js
blob: 83aab8f2a5913ca0c7d01b40dc65e9a6f9a61135 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
var BUGNUMBER = 887016;
var summary = "Call RegExp.prototype[@@replace] from String.prototype.replace.";

print(BUGNUMBER + ": " + summary);

var called = 0;
var myRegExp = {
  [Symbol.replace](S, R) {
    assertEq(S, "abcAbcABC");
    assertEq(R, "foo");
    called++;
    return 42;
  }
};
assertEq("abcAbcABC".replace(myRegExp, "foo"), 42);
assertEq(called, 1);

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