Implement and add support for RegExp.prototype[@@search] (#3436)

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
This commit is contained in:
Dániel Bátyai
2019-12-12 15:59:28 +01:00
committed by Zoltan Herczeg
parent c525b1f10a
commit d3b8bed2c1
8 changed files with 405 additions and 88 deletions
-19
View File
@@ -36,24 +36,5 @@ assert ("aaxbb".search (regexp) === 2);
assert ("aabb".search (regexp) === -1);
assert (regexp.lastIndex === "index");
Object.defineProperty(regexp, "lastIndex", {
configurable : false,
enumerable : false,
value : "index2",
writable : false
});
assert ("axb".search (regexp) === 1);
assert ("aabb".search (regexp) === -1);
assert (regexp.lastIndex === "index2");
assert ("##\ud801\udc00".search ("\ud801") === 2);
assert ("##\ud801\udc00".search ("\udc00") === 3);
// The real "exec" never returns with a number.
Object.getPrototypeOf(/x/).exec = function () { return "???"; }
assert (/y/.exec("y") === "???");
// Changing exec should not affect search.
assert ("ay".search (/y/) === 1);