Minor fix to RegExp.prototype.compile (#4112)

Fixed tests from the exclude list:
<test id="annexB/built-ins/RegExp/prototype/compile/length.js"><reason></reason></test>
<test id="annexB/built-ins/RegExp/prototype/compile/pattern-regexp-flags-defined.js"><reason></reason></test>
<test id="annexB/built-ins/RegExp/prototype/compile/pattern-regexp-immutable-lastindex.js"><reason></reason></test>

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
Szilagyi Adam
2020-08-26 15:16:55 +02:00
committed by GitHub
parent 09c8d28b2c
commit 138151832a
4 changed files with 84 additions and 23 deletions
+66
View File
@@ -144,3 +144,69 @@ assert (r.lastIndex === 0);
assert (RegExp.prototype[Symbol.match].call(/a/y, "aaa").length === 1);
assert (RegExp.prototype[Symbol.match].call(/a/gy, "aaa").length === 3);
var length = Object.getOwnPropertyDescriptor(RegExp.prototype.compile, "length");
assert(!length.enumerable);
assert(!length.writable);
assert(length.configurable);
assert(length.value === 2);
var re = /./;
re.lastIndex = 23;
try {
re.compile(re, null);
assert(false);
} catch (e) {
assert(e instanceof TypeError);
}
try {
re.compile(re, 0);
assert(false);
} catch (e) {
assert(e instanceof TypeError);
}
try {
re.compile(re, '');
assert(false);
} catch (e) {
assert(e instanceof TypeError);
}
try {
re.compile(re, false);
assert(false);
} catch (e) {
assert(e instanceof TypeError);
}
try {
re.compile(re, {});
assert(false);
} catch (e) {
assert(e instanceof TypeError);
}
try {
re.compile(re, []);
assert(false);
} catch (e) {
assert(e instanceof TypeError);
}
assert(re.lastIndex === 23);
var subject = /initial/;
Object.defineProperty(subject, 'lastIndex', { value: 45, writable: false });
try {
subject.compile(/updated/gi);
assert(false);
} catch (e) {
assert(e instanceof TypeError);
}
assert(subject.toString() === new RegExp('updated', 'gi').toString());
assert(subject.lastIndex === 45);
-3
View File
@@ -14,9 +14,6 @@
<test id="annexB/built-ins/RegExp/named-groups/groups-object.js"><reason></reason></test>
<test id="annexB/built-ins/RegExp/named-groups/non-unicode-malformed-lookbehind.js"><reason></reason></test>
<test id="annexB/built-ins/RegExp/named-groups/non-unicode-malformed.js"><reason></reason></test>
<test id="annexB/built-ins/RegExp/prototype/compile/length.js"><reason></reason></test>
<test id="annexB/built-ins/RegExp/prototype/compile/pattern-regexp-flags-defined.js"><reason></reason></test>
<test id="annexB/built-ins/RegExp/prototype/compile/pattern-regexp-immutable-lastindex.js"><reason></reason></test>
<test id="annexB/built-ins/String/prototype/anchor/B.2.3.2.js"><reason></reason></test>
<test id="annexB/built-ins/String/prototype/anchor/attr-tostring-err.js"><reason></reason></test>
<test id="annexB/built-ins/String/prototype/anchor/length.js"><reason></reason></test>