Improve RegExp.prototype[@@replace] poisoned stdlib test

This commit is contained in:
Alexey Shvayka 2020-09-09 22:59:23 +03:00 committed by Rick Waldron
parent d10446a5e4
commit 323905b70e
1 changed files with 11 additions and 0 deletions

View File

@ -17,6 +17,17 @@ assert(delete String.prototype.indexOf);
assert(delete String.prototype.slice);
assert(delete String.prototype.substring);
for (let i = 0; i < 5; ++i) {
Object.defineProperty(Array.prototype, i, {
get: function() {
throw new Test262Error(i + " getter should be unreachable.");
},
set: function(_value) {
throw new Test262Error(i + " setter should be unreachable.");
},
});
}
var str = "1a2";
assert.sameValue(/a/[Symbol.replace](str, "$`b"), "11b2");