Remove ES_NEXT macro (#4915)
- remove all '#JERRY_ESNEXT' macro - remove 5.1 build profile, update test runner accordingly (Note: all builtins are turn on by default) - move tests from tests/jerry/esnext into tests/jerry, concatenate files with same names - add skiplist to some snapshot tests that were supported only in 5.1 - fix doxygen issues that were hidden before (bc. of es.next macro) Co-authored-by: Martin Negyokru negyokru@inf.u-szeged.hu JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
@@ -115,3 +115,203 @@ try {
|
||||
} catch (e) {
|
||||
assert (e === "abrupt lastIndex");
|
||||
}
|
||||
|
||||
|
||||
var r = new RegExp('a', 'gimuy');
|
||||
assert (r.flags === 'gimuy');
|
||||
assert (r.toString() === '/a/gimuy');
|
||||
|
||||
try {
|
||||
Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get.call(42);
|
||||
assert (false);
|
||||
} catch (e) {
|
||||
assert (e instanceof TypeError);
|
||||
}
|
||||
|
||||
var o = {
|
||||
global: true,
|
||||
unicode: true,
|
||||
sticky: true,
|
||||
source: "str"
|
||||
}
|
||||
|
||||
Object.defineProperty(o, 'flags', Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags'));
|
||||
assert(o.flags === "guy");
|
||||
assert (RegExp.prototype.toString.call (o) === "/str/guy");
|
||||
|
||||
Object.defineProperty(o, 'multiline', { 'get': function () {throw "abrupt flag get"; }});
|
||||
try {
|
||||
o.flags
|
||||
assert (false);
|
||||
} catch (e) {
|
||||
assert (e === "abrupt flag get");
|
||||
}
|
||||
|
||||
try {
|
||||
RegExp.prototype.toString.call(42);
|
||||
assert (false);
|
||||
} catch (e) {
|
||||
assert (e instanceof TypeError);
|
||||
}
|
||||
|
||||
assert (RegExp.prototype.toString.call({}) === "/undefined/undefined");
|
||||
|
||||
var o = {};
|
||||
Object.defineProperty (o, 'source', { 'get' : function () {throw "abrupt source get"; } });
|
||||
try {
|
||||
RegExp.prototype.toString.call(o);
|
||||
assert (false);
|
||||
} catch (e) {
|
||||
assert (e === "abrupt source get");
|
||||
}
|
||||
|
||||
var o = {source: {toString: function() {throw "abrupt source toString";}}};
|
||||
try {
|
||||
RegExp.prototype.toString.call(o);
|
||||
assert (false);
|
||||
} catch (e) {
|
||||
assert (e === "abrupt source toString");
|
||||
}
|
||||
|
||||
var o = {source: "str"};
|
||||
Object.defineProperty (o, 'flags', { 'get' : function () {throw "abrupt flags get"; } });
|
||||
try {
|
||||
RegExp.prototype.toString.call(o);
|
||||
assert (false);
|
||||
} catch (e) {
|
||||
assert (e === "abrupt flags get");
|
||||
}
|
||||
|
||||
var o = {source: "str", flags: {toString: function() {throw "abrupt flags toString";}}};
|
||||
try {
|
||||
RegExp.prototype.toString.call(o);
|
||||
assert (false);
|
||||
} catch (e) {
|
||||
assert (e === "abrupt flags toString");
|
||||
}
|
||||
|
||||
var o = {
|
||||
global: true,
|
||||
source: "str"
|
||||
}
|
||||
|
||||
Object.defineProperty(o, 'unicode', { 'get': function () {throw "abrupt unicode get"; }});
|
||||
try {
|
||||
RegExp.prototype[Symbol.match].call(o, "str");
|
||||
assert (false);
|
||||
} catch (e) {
|
||||
assert (e === "abrupt unicode get");
|
||||
}
|
||||
|
||||
assert ("str𐲡fgh".replace(/(?:)/gu, "x") === 'xsxtxrx𐲡xfxgxhx');
|
||||
assert ("str𐲡fgh".replace(/(?:)/g, "x") === 'xsxtxrx\ud803x\udca1xfxgxhx');
|
||||
|
||||
r = /(?:)/gu;
|
||||
/* Disable fast path. */
|
||||
r.exec = function (s) { return RegExp.prototype.exec.call(this, s); };
|
||||
|
||||
assert ("str𐲡fgh".replace(r, "x") === 'xsxtxrx𐲡xfxgxhx');
|
||||
Object.defineProperty(r, 'unicode', {value: false});
|
||||
assert ("str𐲡fgh".replace(r, "x") === 'xsxtxrx\ud803x\udca1xfxgxhx');
|
||||
|
||||
r = /(?:)/gu;
|
||||
assert (RegExp.prototype[Symbol.match].call(r, "str𐲡fgh").length === 8);
|
||||
Object.defineProperty(r, 'unicode', {value: false});
|
||||
assert (RegExp.prototype[Symbol.match].call(r, "str𐲡fgh").length === 9);
|
||||
|
||||
r = /(?:)/gy;
|
||||
r.lastIndex = 2;
|
||||
assert ("asd".replace(r, "x") === "xaxsxdx");
|
||||
assert (r.lastIndex === 0);
|
||||
|
||||
r.lastIndex = 5;
|
||||
assert ("asd".replace(r, "x") === "xaxsxdx");
|
||||
assert (r.lastIndex === 0);
|
||||
|
||||
r = /(?:)/y;
|
||||
r.lastIndex = 2;
|
||||
assert ("asd".replace(r, "x") === "asxd");
|
||||
assert (r.lastIndex === 2);
|
||||
|
||||
r.lastIndex = 5;
|
||||
assert ("asd".replace(r, "x") === "asd");
|
||||
assert (r.lastIndex === 0);
|
||||
|
||||
r.lastIndex = 2;
|
||||
/* Disable fast path. */
|
||||
r.exec = function (s) { return RegExp.prototype.exec.call(this, s); };
|
||||
assert ("asd".replace(r, "x") === "asxd");
|
||||
assert (r.lastIndex === 2);
|
||||
|
||||
r.lastIndex = 5;
|
||||
assert ("asd".replace(r, "x") === "asd");
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user