Transform legacy format to harness assertions: test/built-ins/F*/**/*.js

This commit is contained in:
rwaldron 2021-08-11 14:53:42 -04:00 committed by Leo Balter
parent 6a00f28e50
commit 35ce309dc7
186 changed files with 576 additions and 1289 deletions

View File

@ -11,9 +11,12 @@ description: >
object as a constructor
---*/
//CHECK#1
var x = new function f1() {
return 1;
};
if (typeof(x.constructor) !== "function")
throw new Test262Error('#1: typeof(x.constructor)!=="function"');
assert.sameValue(
typeof(x.constructor),
"function",
'The value of `typeof(x.constructor)` is expected to be "function"'
);

View File

@ -11,30 +11,12 @@ description: Create simple functions and check returned values
var f = Function("return arguments[0];");
//CHECK#1
if (!(f instanceof Function)) {
throw new Test262Error('#1: f instanceof Function');
}
//CHECK#2
if (f(1) !== 1) {
throw new Test262Error('#2: f(1) !== 1');
}
assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
assert.sameValue(f(1), 1, 'f(1) must return 1');
var g = new Function("return arguments[0];");
//CHECK#3
if (!(g instanceof Function)) {
throw new Test262Error('#3: g instanceof Function');
}
//CHECK#4
if (g("A") !== "A") {
throw new Test262Error('#4: g("A") !== "A"');
}
//CHECK#5
if (g("A") !== f("A")) {
throw new Test262Error('#5: g("A") !== f("A")');
}
assert(g instanceof Function, 'The result of evaluating (g instanceof Function) is expected to be true');
assert.sameValue(g("A"), "A", 'g("A") must return "A"');
assert.sameValue(g("A"), f("A"), 'g("A") must return the same value returned by f("A")');

View File

@ -20,12 +20,9 @@ var body = {
}
}
//CHECK#1
try {
var f = new Function(body);
throw new Test262Error('#1: When the Function constructor is called with one argument then body be that argument the following step are taken: call ToString(body)');
} catch (e) {
if (e !== 7) {
throw new Test262Error('#1.1: When the Function constructor is called with one argument then body be that argument the following step are taken: call ToString(body)');
}
assert.sameValue(e, 7, 'The value of e is expected to be 7');
}

View File

@ -14,19 +14,11 @@ es5id: 15.3.2.1_A1_T10
description: Value of the function constructor argument is "null"
---*/
//CHECK#1
try {
var f = new Function(null);
} catch (e) {
throw new Test262Error('#1: test fails with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f() !== undefined) {
throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(), undefined, 'f() returns undefined');

View File

@ -14,19 +14,11 @@ es5id: 15.3.2.1_A1_T11
description: Value of the function constructor argument is "undefined"
---*/
//CHECK#1
try {
var f = new Function(undefined);
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f() !== undefined) {
throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(), undefined, 'f() returns undefined');

View File

@ -14,19 +14,11 @@ es5id: 15.3.2.1_A1_T12
description: Value of the function constructor argument is "void 0"
---*/
//CHECK#1
try {
var f = new Function(void 0);
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f() !== undefined) {
throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(), undefined, 'f() returns undefined');

View File

@ -14,12 +14,12 @@ es5id: 15.3.2.1_A1_T13
description: Value of the function constructor argument is "{}"
---*/
//CHECK#1
try {
var f = new Function({});
throw new Test262Error('#1: test failed with error ' + e);
} catch (e) {
if (!(e instanceof SyntaxError)) {
throw new Test262Error('#1.1: If body is not parsable as FunctionBody then throw a SyntaxError exception');
}
assert(
e instanceof SyntaxError,
'The result of evaluating (e instanceof SyntaxError) is expected to be true'
);
}

View File

@ -22,19 +22,11 @@ var body = {
}
};
//CHECK#1
try {
var f = new Function(body);
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f() !== 1) {
throw new Test262Error('#3: hen the Function constructor is called with one argument then body be that argument the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(), 1, 'f() must return 1');

View File

@ -14,19 +14,11 @@ es5id: 15.3.2.1_A1_T3
description: Value of the function constructor argument is 1
---*/
//CHECK#1
try {
var f = new Function(1);
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f() !== undefined) {
throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(), undefined, 'f() returns undefined');

View File

@ -16,21 +16,13 @@ description: >
specified with "undefined"
---*/
//CHECK#1
try {
var f = new Function(x);
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f() !== undefined) {
throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(), undefined, 'f() returns undefined');
var x;

View File

@ -18,19 +18,11 @@ description: >
var body = Object("return \'A\'");
//CHECK#1
try {
var f = new Function(body);
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f() !== "\u0041") {
throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(), "\u0041", 'f() must return "u0041"');

View File

@ -16,19 +16,11 @@ description: >
true;"
---*/
//CHECK#1
try {
var f = new Function("return true;");
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2');
}
//CHECK#3
if (!(f())) {
throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert(f(), 'f() must return true');

View File

@ -16,19 +16,11 @@ description: Value of the function constructor argument is "Object(1)"
var body = new Object(1);
//CHECK#1
try {
var f = new Function(body);
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f() !== undefined) {
throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(), undefined, 'f() returns undefined');

View File

@ -16,12 +16,12 @@ description: Value of the function constructor argument is "var 1=1;"
var body = "var 1=1;";
//CHECK#1
try {
var f = new Function(body);
throw new Test262Error('#1: If body is not parsable as FunctionBody then throw a SyntaxError exception');
} catch (e) {
if (!(e instanceof SyntaxError)) {
throw new Test262Error('#1.1: If body is not parsable as FunctionBody then throw a SyntaxError exception');
}
assert(
e instanceof SyntaxError,
'The result of evaluating (e instanceof SyntaxError) is expected to be true'
);
}

View File

@ -18,12 +18,5 @@ description: >
var f = new Function("return arguments[0];");
//CHECK#1
if (!(f instanceof Function)) {
throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument and the following steps are taken...');
}
//CHECK#2
if (f("A") !== "A") {
throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and the following steps are taken...');
}
assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
assert.sameValue(f("A"), "A", 'f("A") must return "A"');

View File

@ -11,19 +11,11 @@ description: >
"arg3", "return arg1+arg2+arg3;"
---*/
//CHECK#1
try {
var f = Function("arg1", "arg2", "arg3", "return arg1+arg2+arg3;");
} catch (e) {
throw new Test262Error('#1: test failed');
}
//CHECK#2
if (!(f instanceof Function)) {
throw new Test262Error('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified');
}
//CHECK#3
if (f(1, 2, 3) !== 6) {
throw new Test262Error('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified');
}
assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
assert.sameValue(f(1, 2, 3), 6, 'f(1, 2, 3) must return 6');

View File

@ -11,19 +11,11 @@ description: >
"arg3", "return arg1+arg2+arg3;"
---*/
//CHECK#1
try {
var f = Function("arg1, arg2", "arg3", "return arg1+arg2+arg3;");
} catch (e) {
throw new Test262Error('#1: test failed');
}
//CHECK#2
if (!(f instanceof Function)) {
throw new Test262Error('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified');
}
//CHECK#3
if (f("AB", "BA", 1) !== "ABBA1") {
throw new Test262Error('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified');
}
assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
assert.sameValue(f("AB", "BA", 1), "ABBA1", 'f(AB, BA, 1) must return "ABBA1"');

View File

@ -11,19 +11,11 @@ description: >
arg3", "return arg1+arg2+arg3;"
---*/
//CHECK#1
try {
var f = Function("arg1, arg2, arg3", "return arg1+arg2+arg3;");
} catch (e) {
throw new Test262Error('#1: test failed');
}
//CHECK#2
if (!(f instanceof Function)) {
throw new Test262Error('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified');
}
//CHECK#3
if (f(1, 1, "ABBA") !== "2ABBA") {
throw new Test262Error('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified');
}
assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
assert.sameValue(f(1, 1, "ABBA"), "2ABBA", 'f(1, 1, ABBA) must return "2ABBA"');

View File

@ -19,19 +19,11 @@ var p = {
}
};
//CHECK#1
try {
var f = Function(p, p, p, "return arg1+arg2+arg3;");
} catch (e) {
throw new Test262Error('#1: test failed');
}
//CHECK#2
if (!(f instanceof Function)) {
throw new Test262Error('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified');
}
//CHECK#3
if (f(4, "2", "QUESTION") !== "42QUESTION") {
throw new Test262Error('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified');
}
assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
assert.sameValue(f(4, "2", "QUESTION"), "42QUESTION", 'f(4, 2, QUESTION) must return "42QUESTION"');

View File

@ -19,19 +19,11 @@ var p = {
}
};
//CHECK#1
try {
var f = Function(p + "," + p, p, "return arg1+arg2+arg3;");
} catch (e) {
throw new Test262Error('#1: test failed');
}
//CHECK#2
if (!(f instanceof Function)) {
throw new Test262Error('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified');
}
//CHECK#3
if (f("", 1, 2) !== "12") {
throw new Test262Error('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified');
}
assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
assert.sameValue(f("", 1, 2), "12", 'f(, 1, 2) must return "12"');

View File

@ -19,19 +19,11 @@ var p = {
}
};
//CHECK#1
try {
var f = Function(p + "," + p + "," + p, "return arg1+arg2+arg3;");
} catch (e) {
throw new Test262Error('#1: test failed');
}
//CHECK#2
if (!(f instanceof Function)) {
throw new Test262Error('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified');
}
//CHECK#3
if (f("", 1, p) !== "1arg4") {
throw new Test262Error('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified');
}
assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
assert.sameValue(f("", 1, p), "1arg4", 'f(, 1, {toString: function() {return "arg" + (++i)}}) must return "1arg4"');

View File

@ -30,12 +30,9 @@ var body = {
}
};
//CHECK#1
try {
var f = new Function(p, body);
throw new Test262Error('#1: test failed');
} catch (e) {
if (e !== 1) {
throw new Test262Error('#1.1: i) Let Result(i) be the first argument; ii) Let P be ToString(Result(i))');
}
assert.sameValue(e, 1, 'The value of e is expected to be 1');
}

View File

@ -25,12 +25,12 @@ var p = {
}
};
//CHECK#1
try {
var f = new Function(p, body);
throw new Test262Error('#1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception');
} catch (e) {
if (!(e instanceof SyntaxError)) {
throw new Test262Error('#1.1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception');
}
assert(
e instanceof SyntaxError,
'The result of evaluating (e instanceof SyntaxError) is expected to be true'
);
}

View File

@ -20,19 +20,11 @@ description: >
var p = "a,b,c";
//CHECK#1
try {
var f = new Function(p, void 0);
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f() !== undefined) {
throw new Test262Error('#3: When the Function constructor is called with arguments p, body the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(), undefined, 'f() returns undefined');

View File

@ -20,19 +20,11 @@ description: >
var p = "a,b,c";
//CHECK#1
try {
var f = new Function(p, undefined);
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f() !== undefined) {
throw new Test262Error('#3: When the Function constructor is called with arguments p, body the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(), undefined, 'f() returns undefined');

View File

@ -18,19 +18,11 @@ description: Values of the function constructor arguments are "a,b,c" and "null"
var p = "a,b,c";
//CHECK#1
try {
var f = new Function(p, null);
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f() !== undefined) {
throw new Test262Error('#3: When the Function constructor is called with arguments p, body the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(), undefined, 'f() returns undefined');

View File

@ -20,21 +20,13 @@ description: >
var p = "a,b,c";
//CHECK#1
try {
var f = new Function(p, body);
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f() !== undefined) {
throw new Test262Error('#3: When the Function constructor is called with arguments p, body the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(), undefined, 'f() returns undefined');
var body;

View File

@ -18,19 +18,11 @@ description: >
strings
---*/
//CHECK#1
try {
var f = new Function("", "");
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f() !== undefined) {
throw new Test262Error('#3: When the Function constructor is called with arguments p, body the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(), undefined, 'f() returns undefined');

View File

@ -25,19 +25,11 @@ var p = {
};
var body = "return a;";
//CHECK#1
try {
var f = new Function(p, body);
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f(42) !== 42) {
throw new Test262Error('#3: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(42), 42, 'f(42) must return 42');

View File

@ -31,17 +31,11 @@ var body = {
}
};
//CHECK#1
try {
var f = new Function(p, body);
throw new Test262Error('#1: test failed');
} catch (e) {
if (e !== "body") {
throw new Test262Error('#1.1: i) Let Result(i) be the first argument; ii) Let P be ToString(Result(i))');
}
assert.sameValue(e, "body", 'The value of e is expected to be "body"');
}
//CHECK#2
if (p !== 1) {
throw new Test262Error('#2: i) Let Result(i) be the first argument; ii) Let P be ToString(Result(i))');
}
assert.sameValue(p, 1, 'The value of p is expected to be 1');

View File

@ -20,21 +20,13 @@ description: >
var body = "return 1.1;";
//CHECK#1
try {
var f = new Function(p, body);
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f() !== 1.1) {
throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(), 1.1, 'f() must return 1.1');
var p;

View File

@ -20,19 +20,11 @@ description: >
var body = "return \"A\";";
//CHECK#1
try {
var f = new Function(void 0, body);
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f() !== '\u0041') {
throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(), '\u0041', 'f() must return "u0041"');

View File

@ -20,12 +20,12 @@ description: >
var body = "return true;";
//CHECK#1
try {
var f = new Function(null, body);
throw new Test262Error('#1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception');
} catch (e) {
if (!(e instanceof SyntaxError)) {
throw new Test262Error('#1.1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception');
}
assert(
e instanceof SyntaxError,
'The result of evaluating (e instanceof SyntaxError) is expected to be true'
);
}

View File

@ -22,19 +22,11 @@ var body = "return a;";
var p = Object("a");
//CHECK#1
try {
var f = new Function(p, body);
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f(1) !== 1) {
throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(1), 1, 'f(1) must return 1');

View File

@ -20,19 +20,11 @@ description: >
var body = "return this;";
//CHECK#1
try {
var f = new Function(undefined, body);
} catch (e) {
throw new Test262Error('#1: test failed with error ' + e);
}
//CHECK#2
if (f.constructor !== Function) {
throw new Test262Error('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2');
}
//CHECK#3
if (f() !== this) {
throw new Test262Error('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.sameValue(f(), this, 'f() must return this');

View File

@ -21,12 +21,12 @@ description: >
var body = "return this;";
var p = "1,1";
//CHECK#1
try {
var f = new Function(p, body);
throw new Test262Error('#1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception');
} catch (e) {
if (!(e instanceof SyntaxError)) {
throw new Test262Error('#1.1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception');
}
assert(
e instanceof SyntaxError,
'The result of evaluating (e instanceof SyntaxError) is expected to be true'
);
}

View File

@ -13,12 +13,5 @@ description: >
var f = new Function;
//CHECK#1
if (f.constructor !== Function) {
throw new Test262Error('#1: When Function is called as part of a new expression, it is a constructor: it initialises the newly created object');
}
//CHECK#2
if (f === undefined) {
throw new Test262Error('#2: When Function is called as part of a new expression, it is a constructor: it initialises the newly created object');
}
assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
assert.notSameValue(f, undefined, 'The value of f is expected to not equal ``undefined``');

View File

@ -6,7 +6,4 @@ info: The Function constructor has the property "prototype"
es5id: 15.3.3_A1
description: Checking existence of the property "prototype"
---*/
if (!Function.hasOwnProperty("prototype")) {
throw new Test262Error('#1: The Function constructor has the property "prototype"');
}
assert(Function.hasOwnProperty("prototype"), 'Function.hasOwnProperty("prototype") must return true');

View File

@ -8,8 +8,7 @@ info: |
es5id: 15.3.3_A2_T1
description: Checking prototype of Function
---*/
// CHECK#
if (!(Function.prototype.isPrototypeOf(Function))) {
throw new Test262Error('#1: the value of the internal [[Prototype]] property of the Function constructor is the Function prototype object.');
}
assert(
Function.prototype.isPrototypeOf(Function),
'Function.prototype.isPrototypeOf(Function) must return true'
);

View File

@ -11,7 +11,4 @@ description: Add new property to Function.prototype and check it
Function.prototype.indicator = 1;
//CHECK#
if (Function.indicator != 1) {
throw new Test262Error('#1: the value of the internal [[Prototype]] property of the Function constructor is the Function prototype object.');
}
assert.sameValue(Function.indicator, 1, 'The value of Function.indicator is expected to be 1');

View File

@ -6,13 +6,5 @@ info: Function constructor has length property whose value is 1
es5id: 15.3.3_A3
description: Checking Function.length property
---*/
//CHECK#1
if (!Function.hasOwnProperty("length")) {
throw new Test262Error('#1: Function constructor has length property');
}
//CHECK#2
if (Function.length !== 1) {
throw new Test262Error('#2: Function constructor length property value is 1');
}
assert(Function.hasOwnProperty("length"), 'Function.hasOwnProperty("length") must return true');
assert.sameValue(Function.length, 1, 'The value of Function.length is expected to be 1');

View File

@ -9,6 +9,8 @@ description: For testing use variable f = new Function
var f = new Function;
if (Object.prototype.toString.call(f) !== "[object Function]") {
throw new Test262Error('#1: The value of the [[Class]] property is "Function"');
}
assert.sameValue(
Object.prototype.toString.call(f),
"[object Function]",
'Object.prototype.toString.call(new Function) must return "[object Function]"'
);

View File

@ -9,6 +9,8 @@ description: For testing use variable f = Function()
var f = Function();
if (Object.prototype.toString.call(f) !== "[object Function]") {
throw new Test262Error('#1: The value of the [[Class]] property is "Function"');
}
assert.sameValue(
Object.prototype.toString.call(f),
"[object Function]",
'Object.prototype.toString.call(Function()) must return "[object Function]"'
);

View File

@ -6,18 +6,11 @@ info: Every function instance has a [[Call]] property
es5id: 15.3.5_A2_T1
description: For testing call Function("var x =1; this.y=2;return \"OK\";")()
---*/
assert.sameValue(
Function("var x =1; this.y=2;return \"OK\";")(),
"OK",
'Function("var x =1; this.y=2;return "OK";")() must return "OK"'
);
//CHECK#1
if (Function("var x =1; this.y=2;return \"OK\";")() !== "OK") {
throw new Test262Error('#1: Every function instance has a [[Call]] property');
}
//CHECK#2
if (typeof x !== "undefined") {
throw new Test262Error('#2: Every function instance has a [[Call]] property');
}
//CHECK#3
if (y !== 2) {
throw new Test262Error('#3: Every function instance has a [[Call]] property');
}
assert.sameValue(typeof x, "undefined", 'The value of `typeof x` is expected to be "undefined"');
assert.sameValue(y, 2, 'The value of y is expected to be 2');

View File

@ -8,18 +8,11 @@ description: >
For testing call (new Function("arg1,arg2","var x =arg1;
this.y=arg2;return arg1+arg2;"))("1",2)
---*/
assert.sameValue(
(new Function("arg1,arg2", "var x =arg1; this.y=arg2;return arg1+arg2;"))("1", 2),
"12",
'new Function("arg1,arg2", "var x =arg1; this.y=arg2;return arg1+arg2;")(1, 2) must return "12"'
);
//CHECK#1
if ((new Function("arg1,arg2", "var x =arg1; this.y=arg2;return arg1+arg2;"))("1", 2) !== "12") {
throw new Test262Error('#1: Every function instance has a [[Call]] property');
}
//CHECK#2
if (typeof x !== "undefined") {
throw new Test262Error('#2: Every function instance has a [[Call]] property');
}
//CHECK#3
if (y !== 2) {
throw new Test262Error('#3: Every function instance has a [[Call]] property');
}
assert.sameValue(typeof x, "undefined", 'The value of `typeof x` is expected to be "undefined"');
assert.sameValue(y, 2, 'The value of y is expected to be 2');

View File

@ -10,17 +10,6 @@ description: As constructor use Function("var x =1; this.y=2;return \"OK\";")
var FACTORY = Function("var x =1; this.y=2;return \"OK\";");
var obj = new FACTORY;
//CHECK#1
if (typeof obj !== "object") {
throw new Test262Error('#1: every function instance has a [[Construct]] property');
}
//CHECK#2
if (obj.constructor !== FACTORY) {
throw new Test262Error('#2: every function instance has a [[Construct]] property');
}
//CHECK#3
if (obj.y !== 2) {
throw new Test262Error('#3: every function instance has a [[Construct]] property');
}
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
assert.sameValue(obj.constructor, FACTORY, 'The value of obj.constructor is expected to equal the value of FACTORY');
assert.sameValue(obj.y, 2, 'The value of obj.y is expected to be 2');

View File

@ -12,17 +12,6 @@ description: >
var FACTORY = new Function("arg1,arg2", "var x =1; this.y=arg1+arg2;return \"OK\";");
var obj = new FACTORY("1", 2);
//CHECK#1
if (typeof obj !== "object") {
throw new Test262Error('#1: every function instance has a [[Construct]] property');
}
//CHECK#2
if (obj.constructor !== FACTORY) {
throw new Test262Error('#2: every function instance has a [[Construct]] property');
}
//CHECK#3
if (obj.y !== "12") {
throw new Test262Error('#3: every function instance has a [[Construct]] property');
}
assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
assert.sameValue(obj.constructor, FACTORY, 'The value of obj.constructor is expected to equal the value of FACTORY');
assert.sameValue(obj.y, "12", 'The value of obj.y is expected to be "12"');

View File

@ -11,6 +11,4 @@ var obj = Function;
var thisobj = this.Function;
if (obj !== thisobj) {
throw new Test262Error('Function is the property of global');
}
assert.sameValue(obj, thisobj, 'The value of obj is expected to equal the value of thisobj');

View File

@ -10,11 +10,11 @@ es5id: 15.3_A2_T1
description: Checking if executing "Function.call(this, "var x / = 1;")" fails
---*/
//CHECK#
try {
Function.call(this, "var x / = 1;");
} catch (e) {
if (!(e instanceof SyntaxError)) {
throw new Test262Error('#1: function body must be valid');
}
assert(
e instanceof SyntaxError,
'The result of evaluating (e instanceof SyntaxError) is expected to be true'
);
}

View File

@ -10,11 +10,11 @@ es5id: 15.3_A2_T2
description: Checking if executing "Function.call(this, "var #x = 1;")" fails
---*/
//CHECK#
try {
Function.call(this, "var #x = 1;");
} catch (e) {
if (!(e instanceof SyntaxError)) {
throw new Test262Error('#1: function body must be valid');
}
assert(
e instanceof SyntaxError,
'The result of evaluating (e instanceof SyntaxError) is expected to be true'
);
}

View File

@ -9,7 +9,6 @@ es5id: 15.3_A3_T1
description: First argument is object
---*/
//CHECK#1 - does not throw
var f = Function.call(mars, "return name;");
var mars = {
name: "mars",
@ -21,12 +20,8 @@ var f = Function.call(mars, "this.godname=\"ares\"; return this.color;");
var about_mars = f();
//CHECK#2
if (about_mars !== undefined) {
throw new Test262Error('#2: When applied to the Function object itself, thisArg should be ignored');
}
assert.sameValue(about_mars, undefined);
//CHECK#3
if (this.godname !== "ares" && mars.godname === undefined) {
throw new Test262Error('#3: When applied to the Function object itself, thisArg should be ignored');
}

View File

@ -14,14 +14,8 @@ var planet = "mars";
var f = Function.call("blablastring", "return this.color;");
//CHECK#1
if (f() !== "red") {
throw new Test262Error('#1: ');
}
assert.sameValue(f(), "red", 'f() must return "red"');
var g = Function.call(null, "return this.planet;");
//CHECK#2
if (g() !== "mars") {
throw new Test262Error('#2: ');
}
assert.sameValue(g(), "mars", 'g() must return "mars"');

View File

@ -12,30 +12,22 @@ description: First argument is this, and this don`t have needed variable
var f = Function.call(this, "return planet;");
var g = Function.call(this, "return color;");
//CHECK#1
if (f() !== undefined) {
throw new Test262Error('#1: ');
}
assert.sameValue(f(), undefined, 'f() returns undefined');
var planet = "mars";
//CHECK#2
if (f() !== "mars") {
throw new Test262Error('#2: ');
}
assert.sameValue(f(), "mars", 'f() must return "mars"');
//CHECK#3
try {
g();
throw new Test262Error('#3: ');
} catch (e) {
if (!(e instanceof ReferenceError))
throw new Test262Error('#3.1: ');
assert(
e instanceof ReferenceError,
'The result of evaluating (e instanceof ReferenceError) is expected to be true'
);
}
this.color = "red";
//CHECK#4
if (g() !== "red") {
throw new Test262Error('#4: ');
}
assert.sameValue(g(), "red", 'g() must return "red"');

View File

@ -11,14 +11,8 @@ description: First argument is this, and this have needed variable
var f = Function.call(this, "return planet;");
//CHECK#1
if (f() !== undefined) {
throw new Test262Error('#1: ');
}
assert.sameValue(f(), undefined, 'f() returns undefined');
var planet = "mars";
//CHECK#2
if (f() !== "mars") {
throw new Test262Error('#2: ');
}
assert.sameValue(f(), "mars", 'f() must return "mars"');

View File

@ -14,26 +14,13 @@ description: >
var f = Function.call(this, "return this.planet;");
var g = Function.call(this, "return this.color;");
//CHECK#1
if (f() !== undefined) {
throw new Test262Error('#2: ');
}
assert.sameValue(f(), undefined, 'f() returns undefined');
var planet = "mars";
//CHECK#2
if (f() !== "mars") {
throw new Test262Error('#2: ');
}
//CHECK#3
if (g() !== undefined) {
throw new Test262Error('#3: ');
}
assert.sameValue(f(), "mars", 'f() must return "mars"');
assert.sameValue(g(), undefined, 'g() returns undefined');
this.color = "red";
//CHECK#4
if (g() !== "red") {
throw new Test262Error('#4: ');
}
assert.sameValue(g(), "red", 'g() must return "red"');

View File

@ -13,14 +13,8 @@ description: >
var f = Function.call(this, "return this.planet;");
//CHECK#1
if (f() !== undefined) {
throw new Test262Error('#1: ');
}
assert.sameValue(f(), undefined, 'f() returns undefined');
var planet = "mars";
//CHECK#2
if (f() !== "mars") {
throw new Test262Error('#2: ');
}
assert.sameValue(f(), "mars", 'f() must return "mars"');

View File

@ -17,5 +17,5 @@ info: |
---*/
assert.throws(SyntaxError, function() {
new Function("'use strict'; with ({}) {}");
});
new Function("'use strict'; with ({}) {}");
}, '`new Function("\'use strict\'; with ({}) {}")` throws a SyntaxError exception');

View File

@ -15,37 +15,37 @@ function func() {}
assert.throws(TypeError, function() {
return func.caller;
});
}, 'return func.caller throws a TypeError exception');
assert.throws(TypeError, function() {
func.caller = {};
});
}, 'func.caller = {} throws a TypeError exception');
assert.throws(TypeError, function() {
return func.arguments;
});
}, 'return func.arguments throws a TypeError exception');
assert.throws(TypeError, function() {
func.arguments = {};
});
}, 'func.arguments = {} throws a TypeError exception');
var newfunc = new Function('"use strict"');
assert.sameValue(newfunc.hasOwnProperty('caller'), false, 'strict Functions created using Function constructor do not have own property "caller"');
assert.sameValue(newfunc.hasOwnProperty('arguments'), false, 'strict Functions created using Function constructor do not have own property "arguments"');
assert.sameValue(newfunc.hasOwnProperty('caller'), false, 'newfunc.hasOwnProperty(\'caller\') must return false');
assert.sameValue(newfunc.hasOwnProperty('arguments'), false, 'newfunc.hasOwnProperty(\'arguments\') must return false');
assert.throws(TypeError, function() {
return newfunc.caller;
});
}, 'return newfunc.caller throws a TypeError exception');
assert.throws(TypeError, function() {
newfunc.caller = {};
});
}, 'newfunc.caller = {} throws a TypeError exception');
assert.throws(TypeError, function() {
return newfunc.arguments;
});
}, 'return newfunc.arguments throws a TypeError exception');
assert.throws(TypeError, function() {
newfunc.arguments = {};
});
}, 'newfunc.arguments = {} throws a TypeError exception');

View File

@ -11,12 +11,5 @@ description: Checking length property of Function("arg1,arg2,arg3", null)
var f = new Function("arg1,arg2,arg3", null);
//CHECK#1
if (!(f.hasOwnProperty('length'))) {
throw new Test262Error('#1: the function has length property.');
}
//CHECK#2
if (f.length !== 3) {
throw new Test262Error('#2: The value of the length property is usually an integer that indicates the "typical" number of arguments expected by the function');
}
assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true');
assert.sameValue(f.length, 3, 'The value of f.length is expected to be 3');

View File

@ -13,12 +13,5 @@ description: >
var f = Function("arg1,arg2,arg3", "arg4,arg5", null);
//CHECK#1
if (!(f.hasOwnProperty('length'))) {
throw new Test262Error('#1: the function has length property.');
}
//CHECK#2
if (f.length !== 5) {
throw new Test262Error('#2: The value of the length property is usually an integer that indicates the "typical" number of arguments expected by the function');
}
assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true');
assert.sameValue(f.length, 5, 'The value of f.length is expected to be 5');

View File

@ -13,12 +13,5 @@ description: >
var f = new Function("arg1,arg2,arg3", "arg1,arg2", "arg3", null);
//CHECK#1
if (!(f.hasOwnProperty('length'))) {
throw new Test262Error('#1: the function has length property.');
}
//CHECK#2
if (f.length !== 6) {
throw new Test262Error('#2: The value of the length property is usually an integer that indicates the "typical" number of arguments expected by the function');
}
assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true');
assert.sameValue(f.length, 6, 'The value of f.length is expected to be 6');

View File

@ -11,22 +11,9 @@ description: >
var f = new Function("arg1,arg2,arg3", null);
//CHECK#1
if (!(f.hasOwnProperty('length'))) {
throw new Test262Error('#1: the function has length property.');
}
assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true');
assert(delete f.length, 'The value of delete f.length is expected to be true');
assert(!f.hasOwnProperty('length'), 'The value of !f.hasOwnProperty(\'length\') is expected to be true');
assert.notSameValue(f.length, 3, 'The value of f.length is not 3');
//CHECK#2
if (!delete f.length) {
throw new Test262Error('#2: the function.length property does not have the attributes DontDelete.');
}
//CHECK#3
if (f.hasOwnProperty('length')) {
throw new Test262Error('#3: the function.length property does not have the attributes DontDelete.');
}
//CHECK#4
if (f.length === 3) {
throw new Test262Error('#4: the length property does not have the attributes { DontDelete }');
}
// TODO: Convert to verifyProperty() format.

View File

@ -11,19 +11,11 @@ description: >
var f = Function("arg1,arg2,arg3", "arg4,arg5", null);
//CHECK#1
if (!(f.hasOwnProperty('length'))) {
throw new Test262Error('#1: the function has length property.');
}
assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true');
delete f.length;
//CHECK#2
if (f.hasOwnProperty('length')) {
throw new Test262Error('#2: the function.length property does not have the attributes DontDelete.');
}
assert(!f.hasOwnProperty('length'), 'The value of !f.hasOwnProperty(\'length\') is expected to be true');
assert.notSameValue(f.length, 5, 'The value of f.length is not 5');
//CHECK#3
if (f.length === 5) {
throw new Test262Error('#3: the length property does not have the attributes { DontDelete }');
}
// TODO: Convert to verifyProperty() format.

View File

@ -11,19 +11,11 @@ description: >
var f = new Function("arg1,arg2,arg3", "arg1,arg2", "arg3", null);
//CHECK#1
if (!(f.hasOwnProperty('length'))) {
throw new Test262Error('#1: the function has length property.');
}
assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true');
delete f.length;
//CHECK#2
if (f.hasOwnProperty('length')) {
throw new Test262Error('#2: the function.length property does not have the attributes DontDelete.');
}
assert(!f.hasOwnProperty('length'), 'The value of !f.hasOwnProperty(\'length\') is expected to be true');
assert.notSameValue(f.length, 6, 'The value of f.length is not 6');
//CHECK#3
if (f.length === 6) {
throw new Test262Error('#3: the length property does not have the attributes { DontDelete }');
}
// TODO: Convert to verifyProperty() format.

View File

@ -12,29 +12,25 @@ includes: [propertyHelper.js]
var f = new Function("arg1,arg2,arg3", "arg4,arg5", null);
//CHECK#1
if (!(f.hasOwnProperty('length'))) {
throw new Test262Error('#1: the function has length property.');
}
assert(f.hasOwnProperty('length'));
var flength = f.length;
verifyNotWritable(f, "length", null, function() {});
//CHECK#2
if (f.length !== flength) {
throw new Test262Error('#2: the function.length property has the attributes ReadOnly');
}
assert.sameValue(f.length, flength);
//CHECK#3
try {
f.length();
throw new Test262Error('#3: the function.length property has the attributes ReadOnly');
} catch (e) {
if (e instanceof Test262Error) throw e;
if (e instanceof Test262Error) {
throw e;
}
}
//CHECK#4
if (f.length !== 5) {
throw new Test262Error('#4: the length property has the attributes { ReadOnly }');
}
// TODO: Convert to verifyProperty() format.

View File

@ -12,29 +12,25 @@ includes: [propertyHelper.js]
var f = Function("arg1,arg2,arg3", null);
//CHECK#1
if (!(f.hasOwnProperty('length'))) {
throw new Test262Error('#1: the function has length property.');
}
assert(f.hasOwnProperty('length'));
var flength = f.length;
verifyNotWritable(f, "length", null, function() {});
//CHECK#2
if (f.length !== flength) {
throw new Test262Error('#2: the function.length property has the attributes ReadOnly');
}
assert.sameValue(f.length, flength);
//CHECK#3
try {
f.length();
throw new Test262Error('#3: the function.length property has the attributes ReadOnly');
} catch (e) {
if (e instanceof Test262Error) throw e;
if (e instanceof Test262Error) {
throw e;
}
}
//CHECK#4
if (f.length !== 3) {
throw new Test262Error('#4: the length property has the attributes { ReadOnly }');
}
// TODO: Convert to verifyProperty() format.

View File

@ -12,29 +12,25 @@ includes: [propertyHelper.js]
var f = new Function("arg1,arg2,arg3", "arg1,arg2", "arg3", null);
//CHECK#1
if (!(f.hasOwnProperty('length'))) {
throw new Test262Error('#1: the function has length property.');
}
assert(f.hasOwnProperty('length'));
var flength = f.length;
verifyNotWritable(f, "length", null, function() {});
//CHECK#2
if (f.length !== flength) {
throw new Test262Error('#2: the function.length property has the attributes ReadOnly');
}
assert.sameValue(f.length, flength);
//CHECK#3
try {
f.length();
throw new Test262Error('#3: the function.length property has the attributes ReadOnly');
} catch (e) {
if (e instanceof Test262Error) throw e;
if (e instanceof Test262Error) {
throw e;
}
}
//CHECK#4
if (f.length !== 6) {
throw new Test262Error('#4: the length property has the attributes { ReadOnly }');
}
// TODO: Convert to verifyProperty() format.

View File

@ -11,17 +11,13 @@ description: >
var f = new Function("arg1,arg2,arg3", null);
//CHECK#1
if (!(f.hasOwnProperty('length'))) {
throw new Test262Error('#1: the function has length property.');
}
assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true');
for (var key in f) {
if (key == "length") {
var lengthenumed = true;
}
}
//CHECK#2
if (lengthenumed) {
throw new Test262Error('#2: the length property has the attributes { DontEnum }');
}
assert(!lengthenumed, 'The value of !lengthenumed is expected to be true');
// TODO: Convert to verifyProperty() format.

View File

@ -11,10 +11,7 @@ description: >
var f = Function("arg1,arg2,arg3", "arg5,arg4", null);
//CHECK#1
if (!(f.hasOwnProperty('length'))) {
throw new Test262Error('#1: the function has length property.');
}
assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true');
for (var key in f) {
if (key == "length") {
@ -22,7 +19,6 @@ for (var key in f) {
}
}
//CHECK#2
if (lengthenumed) {
throw new Test262Error('#2: the length property has the attributes { DontEnum }');
}
assert(!lengthenumed, 'The value of !lengthenumed is expected to be true');
// TODO: Convert to verifyProperty() format.

View File

@ -11,10 +11,7 @@ description: >
var f = new Function("arg1,arg2,arg3", "arg1,arg2", "arg3", null);
//CHECK#1
if (!(f.hasOwnProperty('length'))) {
throw new Test262Error('#1: the function has length property.');
}
assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true');
for (var key in f) {
if (key == "length") {
@ -22,7 +19,6 @@ for (var key in f) {
}
}
//CHECK#2
if (lengthenumed) {
throw new Test262Error('#2: the length property has the attributes { DontEnum }');
}
assert(!lengthenumed, 'The value of !lengthenumed is expected to be true');
// TODO: Convert to verifyProperty() format.

View File

@ -14,16 +14,12 @@ verifyNotWritable(Function, "prototype", null, function() {
return "shifted";
});
//CHECK#1
if (Function.prototype !== obj) {
throw new Test262Error('#1: the Function.prototype property has the attributes ReadOnly.');
}
assert.sameValue(Function.prototype, obj, 'The value of Function.prototype is expected to equal the value of obj');
//CHECK#2
try {
if (Function.prototype() !== undefined) {
throw new Test262Error('#2: the Function.prototype property has the attributes ReadOnly');
}
assert.sameValue(Function.prototype(), undefined, 'Function.prototype() returns undefined');
} catch (e) {
throw new Test262Error('#2.1: the Function.prototype property has the attributes ReadOnly: ' + e);
}
// TODO: Convert to verifyProperty() format.

View File

@ -6,19 +6,20 @@ info: The Function.prototype property has the attribute DontEnum
es5id: 15.3.3.1_A2
description: Checking if enumerating the Function.prototype property fails
---*/
// CHECK#1
if (Function.propertyIsEnumerable('prototype')) {
throw new Test262Error('#1: the Function.prototype property has the attributes DontEnum');
}
assert(
!Function.propertyIsEnumerable('prototype'),
'The value of !Function.propertyIsEnumerable(\'prototype\') is expected to be true'
);
// CHECK#2
var count = 0;
for (var p in Function) {
if (p === "prototype") count++;
if (p === "prototype") {
count++;
}
}
if (count !== 0) {
throw new Test262Error('#2: the Function.prototype property has the attributes DontEnum');
}
assert.sameValue(count, 0, 'The value of count is expected to be 0');
// TODO: Convert to verifyProperty() format.

View File

@ -10,17 +10,17 @@ includes: [propertyHelper.js]
verifyNotConfigurable(Function, "prototype");
//CHECK#1
try {
if ((delete Function.prototype) !== false) {
throw new Test262Error('#1: Function.prototype has the attribute DontDelete');
}
assert.sameValue(delete Function.prototype, false);
} catch (e) {
if (e instanceof Test262Error) throw e;
if (e instanceof Test262Error) {
throw e;
}
assert(e instanceof TypeError);
}
//CHECK#2
if (!(Function.hasOwnProperty('prototype'))) {
throw new Test262Error('#2: the Function.prototype property has the attributes DontDelete.');
}
// TODO: Convert to verifyProperty() format.

View File

@ -18,7 +18,9 @@ function foo() {}
Object.defineProperty(foo, 'prototype', {
value: {}
});
if (foo.prototype !==
Object.getOwnPropertyDescriptor(foo, 'prototype').value) {
throw new Test262Error("A function.prototype's descriptor lies");
}
assert.sameValue(
foo.prototype,
Object.getOwnPropertyDescriptor(foo, 'prototype').value,
'The value of foo.prototype is expected to equal the value of Object.getOwnPropertyDescriptor(foo, \'prototype\').value'
);

View File

@ -8,8 +8,8 @@ info: |
es5id: 15.3.4_A1
description: Object.prototype.toString returns [object+[[Class]]+]
---*/
if (Object.prototype.toString.call(Function.prototype) !== "[object Function]") {
throw new Test262Error('#2: The Function prototype object is itself a Function ' +
'object (its [[Class]] is "Function") (15.3.4)');
}
assert.sameValue(
Object.prototype.toString.call(Function.prototype),
"[object Function]",
'Object.prototype.toString.call(Function.prototype) must return "[object Function]"'
);

View File

@ -9,11 +9,8 @@ es5id: 15.3.4_A2_T1
description: Call Function.prototype()
---*/
//CHECK#1
try {
if (Function.prototype() !== undefined) {
throw new Test262Error('#1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined');
}
assert.sameValue(Function.prototype(), undefined, 'Function.prototype() returns undefined');
} catch (e) {
throw new Test262Error('#1.1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined: ' + e);
}

View File

@ -9,11 +9,8 @@ es5id: 15.3.4_A2_T2
description: Call Function.prototype(null,void 0)
---*/
//CHECK#1
try {
if (Function.prototype(null, void 0) !== undefined) {
throw new Test262Error('#1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined');
}
assert.sameValue(Function.prototype(null, void 0), undefined, 'Function.prototype(null, void 0) returns undefined');
} catch (e) {
throw new Test262Error('#1.1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined: ' + e);
}

View File

@ -9,12 +9,5 @@ es5id: 15.3.4_A2_T3
description: Call Function.prototype(x), where x is undefined variable
---*/
//CHECK#1
try {
if (Function.prototype(x) !== undefined) {
var x;
throw new Test262Error('#1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined');
}
} catch (e) {
throw new Test262Error('#1.1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined: ' + e);
}
var x;
assert.sameValue(Function.prototype(x), undefined, 'Function.prototype(x) returns undefined');

View File

@ -8,9 +8,8 @@ info: |
es5id: 15.3.4_A3_T1
description: Checking prototype of Function.prototype
---*/
if (Object.getPrototypeOf(Function.prototype) !== Object.prototype) {
throw new Test262Error('#1: The value of the internal [[Prototype]] property of ' +
'the Function prototype object is the Object prototype ' +
'object (15.3.4)');
}
assert.sameValue(
Object.getPrototypeOf(Function.prototype),
Object.prototype,
'Object.getPrototypeOf(Function.prototype) returns Object.prototype'
);

View File

@ -13,7 +13,4 @@ description: >
Object.prototype.indicator = 1;
//CHECK#1
if (Function.prototype.indicator !== 1) {
throw new Test262Error('#1: The value of the internal [[Prototype]] property of the Function prototype object is the Object prototype object (15.3.2.1)');
}
assert.sameValue(Function.prototype.indicator, 1, 'The value of Function.prototype.indicator is expected to be 1');

View File

@ -9,18 +9,20 @@ info: |
es5id: 15.3.4_A4
description: Checking valueOf property at Function.prototype
---*/
assert.sameValue(
Function.prototype.hasOwnProperty("valueOf"),
false,
'Function.prototype.hasOwnProperty("valueOf") must return false'
);
//CHECK#1
if (Function.prototype.hasOwnProperty("valueOf") !== false) {
throw new Test262Error('#1: The Function prototype object does not have a valueOf property of its own');
}
assert.notSameValue(
typeof Function.prototype.valueOf,
"undefined",
'The value of typeof Function.prototype.valueOf is not "undefined"'
);
//CHECK#2
if (typeof Function.prototype.valueOf === "undefined") {
throw new Test262Error('#2: however, it inherits the valueOf property from the Object prototype Object');
}
//CHECK#3
if (Function.prototype.valueOf !== Object.prototype.valueOf) {
throw new Test262Error('#3: however, it inherits the valueOf property from the Object prototype Object');
}
assert.sameValue(
Function.prototype.valueOf,
Object.prototype.valueOf,
'The value of Function.prototype.valueOf is expected to equal the value of Object.prototype.valueOf'
);

View File

@ -11,4 +11,4 @@ description: Checking if creating "new Function.prototype object" fails
assert.throws(TypeError, function() {
new Function.prototype;
});
}, '`new Function.prototype` throws a TypeError exception');

View File

@ -12,26 +12,23 @@ includes: [propertyHelper.js]
var f = new Function("", null);
//CHECK#1
if (!(f.hasOwnProperty('prototype'))) {
throw new Test262Error('#1: the function has length property.');
}
assert(f.hasOwnProperty('prototype'));
var fproto = f.prototype;
verifyNotConfigurable(f, "prototype");
//CHECK#2
try {
if ((delete f.prototype) !== false) {
throw new Test262Error('#2: the prototype property has the attributes { DontDelete }');
}
assert.sameValue(delete f.prototype, false);
} catch (e) {
if (e instanceof Test262Error) throw e;
if (e instanceof Test262Error) {
throw e;
}
assert(e instanceof TypeError);
}
//CHECK#3
if (f.prototype !== fproto) {
throw new Test262Error('#3: the prototype property has the attributes { DontDelete }');
}
// TODO: Convert to verifyProperty() format.

View File

@ -12,26 +12,23 @@ includes: [propertyHelper.js]
var f = Function(void 0, "");
//CHECK#1
if (!(f.hasOwnProperty('prototype'))) {
throw new Test262Error('#1: the function has length property.');
}
assert(f.hasOwnProperty('prototype'));
var fproto = f.prototype;
verifyNotConfigurable(f, "prototype");
//CHECK#2
try {
if ((delete f.prototype) !== false) {
throw new Test262Error('#2: the prototype property has the attributes { DontDelete }');
}
assert.sameValue(delete f.prototype, false);
} catch (e) {
if (e instanceof Test262Error) throw e;
if (e instanceof Test262Error) {
throw e;
}
assert(e instanceof TypeError);
}
//CHECK#3
if (f.prototype !== fproto) {
throw new Test262Error('#3: the prototype property has the attributes { DontDelete }');
}
// TODO: Convert to verifyProperty() format.

View File

@ -8,8 +8,8 @@ description: >
Checking if obtaining the prototype property of
Function.prototype.apply fails
---*/
//CHECK#1
if (Function.prototype.apply.prototype !== undefined) {
throw new Test262Error('#1: Function.prototype.apply has not prototype property' + Function.prototype.apply.prototype);
}
assert.sameValue(
Function.prototype.apply.prototype,
undefined,
'The value of Function.prototype.apply.prototype is expected to equal undefined'
);

View File

@ -14,23 +14,17 @@ description: >
var proto = Function();
function FACTORY() {};
function FACTORY() {}
FACTORY.prototype = proto;
var obj = new FACTORY;
//CHECK#1
if (typeof obj.apply !== "function") {
throw new Test262Error('#1: apply method accessed');
}
assert.sameValue(typeof obj.apply, "function", 'The value of `typeof obj.apply` is expected to be "function"');
//CHECK#2
try {
obj.apply();
throw new Test262Error('#2: If the object does not have a [[Call]] property, a TypeError exception is thrown');
} catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#2.1: If the object does not have a [[Call]] property, a TypeError exception is thrown');
}
assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true');
}

View File

@ -12,23 +12,17 @@ description: >
property. Prototype of the object is Function.prototype
---*/
function FACTORY() {};
function FACTORY() {}
FACTORY.prototype = Function.prototype;
var obj = new FACTORY;
//CHECK#1
if (typeof obj.apply !== "function") {
throw new Test262Error('#1: apply method accessed');
}
assert.sameValue(typeof obj.apply, "function", 'The value of `typeof obj.apply` is expected to be "function"');
//CHECK#2
try {
obj.apply();
throw new Test262Error('#2: If the object does not have a [[Call]] property, a TypeError exception is thrown');
} catch (e) {
if (!(e instanceof TypeError)) {
throw new Test262Error('#2.1: If the object does not have a [[Call]] property, a TypeError exception is thrown');
}
assert(e instanceof TypeError, 'The result of evaluating (e instanceof TypeError) is expected to be true');
}

View File

@ -11,7 +11,4 @@ description: Not any arguments at apply function
Function("this.field=\"strawberry\"").apply();
//CHECK#1
if (this["field"] !== "strawberry") {
throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value');
}
assert.sameValue(this["field"], "strawberry", 'The value of this["field"] is expected to be "strawberry"');

View File

@ -12,7 +12,4 @@ flags: [noStrict]
eval(" (function(){this.feat=1}).apply()");
//CHECK#1
if (this["feat"] !== 1) {
throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value');
}
assert.sameValue(this["feat"], 1, 'The value of this["feat"] is expected to be 1');

View File

@ -11,7 +11,4 @@ description: Argument at apply function is null
Function("this.field=\"green\"").apply(null);
//CHECK#1
if (this["field"] !== "green") {
throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value');
}
assert.sameValue(this["field"], "green", 'The value of this["field"] is expected to be "green"');

View File

@ -11,7 +11,4 @@ description: Argument at apply function is void 0
Function("this.field=\"battle\"").apply(void 0);
//CHECK#1
if (this["field"] !== "battle") {
throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value');
}
assert.sameValue(this["field"], "battle", 'The value of this["field"] is expected to be "battle"');

View File

@ -11,7 +11,4 @@ description: Argument at apply function is undefined
Function("this.field=\"oil\"").apply(undefined);
//CHECK#1
if (this["field"] !== "oil") {
throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value');
}
assert.sameValue(this["field"], "oil", 'The value of this["field"] is expected to be "oil"');

View File

@ -13,16 +13,9 @@ description: >
function FACTORY() {
Function("this.feat=\"in da haus\"").apply();
};
}
var obj = new FACTORY;
//CHECK#1
if (this["feat"] !== "in da haus") {
throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value');
}
//CHECK#2
if (typeof obj.feat !== "undefined") {
throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value');
}
assert.sameValue(this["feat"], "in da haus", 'The value of this["feat"] is expected to be "in da haus"');
assert.sameValue(typeof obj.feat, "undefined", 'The value of `typeof obj.feat` is expected to be "undefined"');

View File

@ -16,16 +16,9 @@ function FACTORY() {
(function() {
this.feat = "kamon beyba"
}).apply(null);
};
}
var obj = new FACTORY;
//CHECK#1
if (this["feat"] !== "kamon beyba") {
throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value');
}
//CHECK#2
if (typeof obj.feat !== "undefined") {
throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value');
}
assert.sameValue(this["feat"], "kamon beyba", 'The value of this["feat"] is expected to be "kamon beyba"');
assert.sameValue(typeof obj.feat, "undefined", 'The value of `typeof obj.feat` is expected to be "undefined"');

View File

@ -16,7 +16,4 @@ description: >
})();
//CHECK#1
if (this["feat"] !== "in da haus") {
throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value');
}
assert.sameValue(this["feat"], "in da haus", 'The value of this["feat"] is expected to be "in da haus"');

View File

@ -18,7 +18,4 @@ flags: [noStrict]
}).apply(undefined);
})();
//CHECK#1
if (this["feat"] !== "kamon beyba") {
throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value');
}
assert.sameValue(this["feat"], "kamon beyba", 'The value of this["feat"] is expected to be "kamon beyba"');

View File

@ -11,7 +11,4 @@ description: Checking by using eval, argument at apply function is void 0
eval(" Function(\"this.feat=1\").apply(void 0) ");
//CHECK#1
if (this["feat"] !== 1) {
throw new Test262Error('#1: If thisArg is null or undefined, the called function is passed the global object as the this value');
}
assert.sameValue(this["feat"], 1, 'The value of this["feat"] is expected to be 1');

View File

@ -13,12 +13,5 @@ var obj = 1;
var retobj = Function("this.touched= true; return this;").apply(obj);
//CHECK#1
if (typeof obj.touched !== "undefined") {
throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value');
}
//CHECK#2
if (!(retobj["touched"])) {
throw new Test262Error('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value');
}
assert.sameValue(typeof obj.touched, "undefined", 'The value of `typeof obj.touched` is expected to be "undefined"');
assert(retobj["touched"], 'The value of retobj["touched"] is expected to be true');

View File

@ -13,12 +13,5 @@ var obj = true;
var retobj = new Function("this.touched= true; return this;").apply(obj);
//CHECK#1
if (typeof obj.touched !== "undefined") {
throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value');
}
//CHECK#2
if (!(retobj["touched"])) {
throw new Test262Error('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value');
}
assert.sameValue(typeof obj.touched, "undefined", 'The value of `typeof obj.touched` is expected to be "undefined"');
assert(retobj["touched"], 'The value of retobj["touched"] is expected to be true');

View File

@ -17,12 +17,5 @@ var retobj = (function() {
return this;
}).apply(obj);
//CHECK#1
if (typeof obj.touched !== "undefined") {
throw new Test262Error('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value');
}
//CHECK#2
if (!(retobj["touched"])) {
throw new Test262Error('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value');
}
assert.sameValue(typeof obj.touched, "undefined", 'The value of `typeof obj.touched` is expected to be "undefined"');
assert(retobj["touched"], 'The value of retobj["touched"] is expected to be true');

Some files were not shown because too many files have changed in this diff Show More