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:
@@ -142,3 +142,245 @@ function nested_args()
|
||||
assert(a === 3);
|
||||
}
|
||||
nested_args(3);
|
||||
|
||||
|
||||
function f1(a, b, c)
|
||||
{
|
||||
'use strict';
|
||||
assert(!Object.hasOwnProperty(arguments,'caller'));
|
||||
}
|
||||
|
||||
f1(1, 2, 3);
|
||||
|
||||
// Normal arguments access
|
||||
|
||||
function f2(a = arguments)
|
||||
{
|
||||
assert(arguments[1] === 2)
|
||||
var arguments = 1
|
||||
assert(arguments === 1)
|
||||
assert(a[1] === 2)
|
||||
}
|
||||
f2(undefined, 2)
|
||||
|
||||
function f3(a = arguments)
|
||||
{
|
||||
assert(arguments() === "X")
|
||||
function arguments() { return "X" }
|
||||
assert(arguments() === "X")
|
||||
assert(a[1] === "R")
|
||||
}
|
||||
f3(undefined, "R")
|
||||
|
||||
function f4(a = arguments)
|
||||
{
|
||||
const arguments = 3.25
|
||||
assert(arguments === 3.25)
|
||||
assert(a[1] === -1.5)
|
||||
}
|
||||
f4(undefined, -1.5)
|
||||
|
||||
// Normal arguments access with eval
|
||||
|
||||
function f5(a = arguments)
|
||||
{
|
||||
assert(arguments[1] === 2)
|
||||
var arguments = 1
|
||||
assert(arguments === 1)
|
||||
assert(a[1] === 2)
|
||||
eval()
|
||||
}
|
||||
f5(undefined, 2)
|
||||
|
||||
function f6(a = arguments)
|
||||
{
|
||||
assert(arguments() === "X")
|
||||
function arguments() { return "X" }
|
||||
assert(arguments() === "X")
|
||||
assert(a[1] === "R")
|
||||
eval()
|
||||
}
|
||||
f6(undefined, "R")
|
||||
|
||||
function f7(a = arguments)
|
||||
{
|
||||
const arguments = 3.25
|
||||
assert(arguments === 3.25)
|
||||
assert(a[1] === -1.5)
|
||||
eval()
|
||||
}
|
||||
f7(undefined, -1.5)
|
||||
|
||||
// Argument access through a function
|
||||
|
||||
function f8(a = () => arguments)
|
||||
{
|
||||
assert(arguments[1] === 2)
|
||||
var arguments = 1
|
||||
assert(arguments === 1)
|
||||
assert(a()[1] === 2)
|
||||
}
|
||||
f8(undefined, 2)
|
||||
|
||||
function f9(a = () => arguments)
|
||||
{
|
||||
assert(arguments() === "X")
|
||||
function arguments() { return "X" }
|
||||
assert(arguments() === "X")
|
||||
assert(a()[1] === "R")
|
||||
}
|
||||
f9(undefined, "R")
|
||||
|
||||
function f10(a = () => arguments)
|
||||
{
|
||||
let arguments = 3.25
|
||||
assert(arguments === 3.25)
|
||||
assert(a()[1] === -1.5)
|
||||
}
|
||||
f10(undefined, -1.5)
|
||||
|
||||
// Argument access through an eval
|
||||
|
||||
function f11(a = eval("() => arguments"))
|
||||
{
|
||||
assert(arguments[1] === 2)
|
||||
var arguments = 1
|
||||
assert(arguments === 1)
|
||||
assert(a()[1] === 2)
|
||||
}
|
||||
f11(undefined, 2)
|
||||
|
||||
function f12(a = eval("() => arguments"))
|
||||
{
|
||||
assert(arguments() === "X")
|
||||
function arguments() { return "X" }
|
||||
assert(arguments() === "X")
|
||||
assert(a()[1] === "R")
|
||||
}
|
||||
f12(undefined, "R")
|
||||
|
||||
function f13(a = eval("() => arguments"))
|
||||
{
|
||||
const arguments = 3.25
|
||||
assert(arguments === 3.25)
|
||||
assert(a()[1] === -1.5)
|
||||
}
|
||||
f13(undefined, -1.5)
|
||||
|
||||
// Other cases
|
||||
|
||||
try {
|
||||
function f14(a = arguments)
|
||||
{
|
||||
assert(a[1] === 6)
|
||||
arguments;
|
||||
let arguments = 1;
|
||||
}
|
||||
f14(undefined, 6)
|
||||
assert(false)
|
||||
} catch (e) {
|
||||
assert(e instanceof ReferenceError)
|
||||
}
|
||||
|
||||
try {
|
||||
eval("'use strict'; function f(a = arguments) { arguments = 5; eval() }");
|
||||
assert(false)
|
||||
} catch (e) {
|
||||
assert(e instanceof SyntaxError)
|
||||
}
|
||||
|
||||
function f15()
|
||||
{
|
||||
assert(arguments[0] === "A")
|
||||
var arguments = 1
|
||||
assert(arguments === 1)
|
||||
}
|
||||
f15("A")
|
||||
|
||||
function f16()
|
||||
{
|
||||
assert(arguments() === "W")
|
||||
function arguments() { return "W" }
|
||||
assert(arguments() === "W")
|
||||
}
|
||||
f16("A")
|
||||
|
||||
function f17(a = arguments = "Val")
|
||||
{
|
||||
assert(arguments === "Val")
|
||||
}
|
||||
f17();
|
||||
|
||||
function f18(s = (v) => arguments = v, g = () => arguments)
|
||||
{
|
||||
const arguments = -3.25
|
||||
s("X")
|
||||
|
||||
assert(g() === "X")
|
||||
assert(arguments === -3.25)
|
||||
}
|
||||
f18()
|
||||
|
||||
function f19(e = (v) => eval(v))
|
||||
{
|
||||
var arguments = -12.5
|
||||
e("arguments[0] = 4.5")
|
||||
|
||||
assert(e("arguments[0]") === 4.5)
|
||||
assert(e("arguments[1]") === "A")
|
||||
assert(arguments === -12.5)
|
||||
}
|
||||
f19(undefined, "A");
|
||||
|
||||
function f20 (arguments, a = eval('arguments')) {
|
||||
assert(a === 3.1);
|
||||
assert(arguments === 3.1);
|
||||
}
|
||||
f20(3.1);
|
||||
|
||||
function f21 (arguments, a = arguments) {
|
||||
assert(a === 3.1);
|
||||
assert(arguments === 3.1);
|
||||
}
|
||||
f21(3.1);
|
||||
|
||||
function f22 (arguments, [a = arguments]) {
|
||||
assert(a === 3.1);
|
||||
assert(arguments === 3.1);
|
||||
}
|
||||
f22(3.1, []);
|
||||
|
||||
try {
|
||||
function f23(p = eval("var arguments"), arguments)
|
||||
{
|
||||
}
|
||||
f23()
|
||||
assert(false)
|
||||
} catch (e) {
|
||||
assert(e instanceof SyntaxError)
|
||||
}
|
||||
|
||||
try {
|
||||
function f24(p = eval("var arguments")) {
|
||||
let arguments;
|
||||
}
|
||||
f24()
|
||||
assert(false)
|
||||
} catch (e) {
|
||||
assert(e instanceof SyntaxError)
|
||||
}
|
||||
|
||||
try {
|
||||
function f25(p = eval("var arguments")) {
|
||||
function arguments() { }
|
||||
}
|
||||
f25()
|
||||
assert(false)
|
||||
} catch (e) {
|
||||
assert(e instanceof SyntaxError)
|
||||
}
|
||||
|
||||
function f26(arguments, eval = () => eval()) {
|
||||
assert(arguments === undefined);
|
||||
}
|
||||
f26(undefined);
|
||||
|
||||
Reference in New Issue
Block a user