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 object as a constructor
---*/ ---*/
//CHECK#1
var x = new function f1() { var x = new function f1() {
return 1; 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];"); var f = Function("return arguments[0];");
//CHECK#1 assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
if (!(f instanceof Function)) { assert.sameValue(f(1), 1, 'f(1) must return 1');
throw new Test262Error('#1: f instanceof Function');
}
//CHECK#2
if (f(1) !== 1) {
throw new Test262Error('#2: f(1) !== 1');
}
var g = new Function("return arguments[0];"); var g = new Function("return arguments[0];");
//CHECK#3 assert(g instanceof Function, 'The result of evaluating (g instanceof Function) is expected to be true');
if (!(g instanceof Function)) { assert.sameValue(g("A"), "A", 'g("A") must return "A"');
throw new Test262Error('#3: g instanceof Function'); assert.sameValue(g("A"), f("A"), 'g("A") must return the same value returned by f("A")');
}
//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")');
}

View File

@ -20,12 +20,9 @@ var body = {
} }
} }
//CHECK#1
try { try {
var f = new Function(body); 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)'); 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) { } catch (e) {
if (e !== 7) { assert.sameValue(e, 7, 'The value of e is expected to be 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)');
}
} }

View File

@ -14,19 +14,11 @@ es5id: 15.3.2.1_A1_T10
description: Value of the function constructor argument is "null" description: Value of the function constructor argument is "null"
---*/ ---*/
//CHECK#1
try { try {
var f = new Function(null); var f = new Function(null);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test fails with error ' + e); throw new Test262Error('#1: test fails with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(), undefined, 'f() returns undefined');
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...');
}

View File

@ -14,19 +14,11 @@ es5id: 15.3.2.1_A1_T11
description: Value of the function constructor argument is "undefined" description: Value of the function constructor argument is "undefined"
---*/ ---*/
//CHECK#1
try { try {
var f = new Function(undefined); var f = new Function(undefined);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(), undefined, 'f() returns undefined');
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...');
}

View File

@ -14,19 +14,11 @@ es5id: 15.3.2.1_A1_T12
description: Value of the function constructor argument is "void 0" description: Value of the function constructor argument is "void 0"
---*/ ---*/
//CHECK#1
try { try {
var f = new Function(void 0); var f = new Function(void 0);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(), undefined, 'f() returns undefined');
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...');
}

View File

@ -14,12 +14,12 @@ es5id: 15.3.2.1_A1_T13
description: Value of the function constructor argument is "{}" description: Value of the function constructor argument is "{}"
---*/ ---*/
//CHECK#1
try { try {
var f = new Function({}); var f = new Function({});
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} catch (e) { } catch (e) {
if (!(e instanceof SyntaxError)) { assert(
throw new Test262Error('#1.1: If body is not parsable as FunctionBody then throw a SyntaxError exception'); 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 { try {
var f = new Function(body); var f = new Function(body);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(), 1, 'f() must return 1');
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...');
}

View File

@ -14,19 +14,11 @@ es5id: 15.3.2.1_A1_T3
description: Value of the function constructor argument is 1 description: Value of the function constructor argument is 1
---*/ ---*/
//CHECK#1
try { try {
var f = new Function(1); var f = new Function(1);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(), undefined, 'f() returns undefined');
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...');
}

View File

@ -16,21 +16,13 @@ description: >
specified with "undefined" specified with "undefined"
---*/ ---*/
//CHECK#1
try { try {
var f = new Function(x); var f = new Function(x);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(), undefined, 'f() returns undefined');
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...');
}
var x; var x;

View File

@ -18,19 +18,11 @@ description: >
var body = Object("return \'A\'"); var body = Object("return \'A\'");
//CHECK#1
try { try {
var f = new Function(body); var f = new Function(body);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(), "\u0041", 'f() must return "u0041"');
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...');
}

View File

@ -16,19 +16,11 @@ description: >
true;" true;"
---*/ ---*/
//CHECK#1
try { try {
var f = new Function("return true;"); var f = new Function("return true;");
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert(f(), 'f() must return true');
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...');
}

View File

@ -16,19 +16,11 @@ description: Value of the function constructor argument is "Object(1)"
var body = new Object(1); var body = new Object(1);
//CHECK#1
try { try {
var f = new Function(body); var f = new Function(body);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(), undefined, 'f() returns undefined');
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...');
}

View File

@ -16,12 +16,12 @@ description: Value of the function constructor argument is "var 1=1;"
var body = "var 1=1;"; var body = "var 1=1;";
//CHECK#1
try { try {
var f = new Function(body); var f = new Function(body);
throw new Test262Error('#1: If body is not parsable as FunctionBody then throw a SyntaxError exception'); throw new Test262Error('#1: If body is not parsable as FunctionBody then throw a SyntaxError exception');
} catch (e) { } catch (e) {
if (!(e instanceof SyntaxError)) { assert(
throw new Test262Error('#1.1: If body is not parsable as FunctionBody then throw a SyntaxError exception'); 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];"); var f = new Function("return arguments[0];");
//CHECK#1 assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
if (!(f instanceof Function)) { assert.sameValue(f("A"), "A", 'f("A") must return "A"');
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...');
}

View File

@ -11,19 +11,11 @@ description: >
"arg3", "return arg1+arg2+arg3;" "arg3", "return arg1+arg2+arg3;"
---*/ ---*/
//CHECK#1
try { try {
var f = Function("arg1", "arg2", "arg3", "return arg1+arg2+arg3;"); var f = Function("arg1", "arg2", "arg3", "return arg1+arg2+arg3;");
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed'); throw new Test262Error('#1: test failed');
} }
//CHECK#2 assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
if (!(f instanceof Function)) { assert.sameValue(f(1, 2, 3), 6, 'f(1, 2, 3) must return 6');
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');
}

View File

@ -11,19 +11,11 @@ description: >
"arg3", "return arg1+arg2+arg3;" "arg3", "return arg1+arg2+arg3;"
---*/ ---*/
//CHECK#1
try { try {
var f = Function("arg1, arg2", "arg3", "return arg1+arg2+arg3;"); var f = Function("arg1, arg2", "arg3", "return arg1+arg2+arg3;");
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed'); throw new Test262Error('#1: test failed');
} }
//CHECK#2 assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
if (!(f instanceof Function)) { assert.sameValue(f("AB", "BA", 1), "ABBA1", 'f(AB, BA, 1) must return "ABBA1"');
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');
}

View File

@ -11,19 +11,11 @@ description: >
arg3", "return arg1+arg2+arg3;" arg3", "return arg1+arg2+arg3;"
---*/ ---*/
//CHECK#1
try { try {
var f = Function("arg1, arg2, arg3", "return arg1+arg2+arg3;"); var f = Function("arg1, arg2, arg3", "return arg1+arg2+arg3;");
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed'); throw new Test262Error('#1: test failed');
} }
//CHECK#2 assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
if (!(f instanceof Function)) { assert.sameValue(f(1, 1, "ABBA"), "2ABBA", 'f(1, 1, ABBA) must return "2ABBA"');
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');
}

View File

@ -19,19 +19,11 @@ var p = {
} }
}; };
//CHECK#1
try { try {
var f = Function(p, p, p, "return arg1+arg2+arg3;"); var f = Function(p, p, p, "return arg1+arg2+arg3;");
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed'); throw new Test262Error('#1: test failed');
} }
//CHECK#2 assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
if (!(f instanceof Function)) { assert.sameValue(f(4, "2", "QUESTION"), "42QUESTION", 'f(4, 2, QUESTION) must return "42QUESTION"');
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');
}

View File

@ -19,19 +19,11 @@ var p = {
} }
}; };
//CHECK#1
try { try {
var f = Function(p + "," + p, p, "return arg1+arg2+arg3;"); var f = Function(p + "," + p, p, "return arg1+arg2+arg3;");
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed'); throw new Test262Error('#1: test failed');
} }
//CHECK#2 assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
if (!(f instanceof Function)) { assert.sameValue(f("", 1, 2), "12", 'f(, 1, 2) must return "12"');
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');
}

View File

@ -19,19 +19,11 @@ var p = {
} }
}; };
//CHECK#1
try { try {
var f = Function(p + "," + p + "," + p, "return arg1+arg2+arg3;"); var f = Function(p + "," + p + "," + p, "return arg1+arg2+arg3;");
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed'); throw new Test262Error('#1: test failed');
} }
//CHECK#2 assert(f instanceof Function, 'The result of evaluating (f instanceof Function) is expected to be true');
if (!(f instanceof Function)) { assert.sameValue(f("", 1, p), "1arg4", 'f(, 1, {toString: function() {return "arg" + (++i)}}) must return "1arg4"');
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');
}

View File

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

View File

@ -25,12 +25,12 @@ var p = {
} }
}; };
//CHECK#1
try { try {
var f = new Function(p, body); var f = new Function(p, body);
throw new Test262Error('#1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); throw new Test262Error('#1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception');
} catch (e) { } catch (e) {
if (!(e instanceof SyntaxError)) { assert(
throw new Test262Error('#1.1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); 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"; var p = "a,b,c";
//CHECK#1
try { try {
var f = new Function(p, void 0); var f = new Function(p, void 0);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(), undefined, 'f() returns undefined');
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...');
}

View File

@ -20,19 +20,11 @@ description: >
var p = "a,b,c"; var p = "a,b,c";
//CHECK#1
try { try {
var f = new Function(p, undefined); var f = new Function(p, undefined);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(), undefined, 'f() returns undefined');
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...');
}

View File

@ -18,19 +18,11 @@ description: Values of the function constructor arguments are "a,b,c" and "null"
var p = "a,b,c"; var p = "a,b,c";
//CHECK#1
try { try {
var f = new Function(p, null); var f = new Function(p, null);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(), undefined, 'f() returns undefined');
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...');
}

View File

@ -20,21 +20,13 @@ description: >
var p = "a,b,c"; var p = "a,b,c";
//CHECK#1
try { try {
var f = new Function(p, body); var f = new Function(p, body);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(), undefined, 'f() returns undefined');
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...');
}
var body; var body;

View File

@ -18,19 +18,11 @@ description: >
strings strings
---*/ ---*/
//CHECK#1
try { try {
var f = new Function("", ""); var f = new Function("", "");
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(), undefined, 'f() returns undefined');
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...');
}

View File

@ -25,19 +25,11 @@ var p = {
}; };
var body = "return a;"; var body = "return a;";
//CHECK#1
try { try {
var f = new Function(p, body); var f = new Function(p, body);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(42), 42, 'f(42) must return 42');
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');
}

View File

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

View File

@ -20,21 +20,13 @@ description: >
var body = "return 1.1;"; var body = "return 1.1;";
//CHECK#1
try { try {
var f = new Function(p, body); var f = new Function(p, body);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(), 1.1, 'f() must return 1.1');
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...');
}
var p; var p;

View File

@ -20,19 +20,11 @@ description: >
var body = "return \"A\";"; var body = "return \"A\";";
//CHECK#1
try { try {
var f = new Function(void 0, body); var f = new Function(void 0, body);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(), '\u0041', 'f() must return "u0041"');
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...');
}

View File

@ -20,12 +20,12 @@ description: >
var body = "return true;"; var body = "return true;";
//CHECK#1
try { try {
var f = new Function(null, body); var f = new Function(null, body);
throw new Test262Error('#1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); throw new Test262Error('#1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception');
} catch (e) { } catch (e) {
if (!(e instanceof SyntaxError)) { assert(
throw new Test262Error('#1.1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); 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"); var p = Object("a");
//CHECK#1
try { try {
var f = new Function(p, body); var f = new Function(p, body);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(1), 1, 'f(1) must return 1');
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...');
}

View File

@ -20,19 +20,11 @@ description: >
var body = "return this;"; var body = "return this;";
//CHECK#1
try { try {
var f = new Function(undefined, body); var f = new Function(undefined, body);
} catch (e) { } catch (e) {
throw new Test262Error('#1: test failed with error ' + e); throw new Test262Error('#1: test failed with error ' + e);
} }
//CHECK#2 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.sameValue(f(), this, 'f() must return this');
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...');
}

View File

@ -21,12 +21,12 @@ description: >
var body = "return this;"; var body = "return this;";
var p = "1,1"; var p = "1,1";
//CHECK#1
try { try {
var f = new Function(p, body); var f = new Function(p, body);
throw new Test262Error('#1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); throw new Test262Error('#1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception');
} catch (e) { } catch (e) {
if (!(e instanceof SyntaxError)) { assert(
throw new Test262Error('#1.1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); 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; var f = new Function;
//CHECK#1 assert.sameValue(f.constructor, Function, 'The value of f.constructor is expected to equal the value of Function');
if (f.constructor !== Function) { assert.notSameValue(f, undefined, 'The value of f is expected to not equal ``undefined``');
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');
}

View File

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

View File

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

View File

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

View File

@ -6,13 +6,5 @@ info: Function constructor has length property whose value is 1
es5id: 15.3.3_A3 es5id: 15.3.3_A3
description: Checking Function.length property description: Checking Function.length property
---*/ ---*/
assert(Function.hasOwnProperty("length"), 'Function.hasOwnProperty("length") must return true');
//CHECK#1 assert.sameValue(Function.length, 1, 'The value of Function.length is expected to be 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');
}

View File

@ -9,6 +9,8 @@ description: For testing use variable f = new Function
var f = new Function; var f = new Function;
if (Object.prototype.toString.call(f) !== "[object Function]") { assert.sameValue(
throw new Test262Error('#1: The value of the [[Class]] property is "Function"'); 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(); var f = Function();
if (Object.prototype.toString.call(f) !== "[object Function]") { assert.sameValue(
throw new Test262Error('#1: The value of the [[Class]] property is "Function"'); 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 es5id: 15.3.5_A2_T1
description: For testing call Function("var x =1; this.y=2;return \"OK\";")() 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 assert.sameValue(typeof x, "undefined", 'The value of `typeof x` is expected to be "undefined"');
if (Function("var x =1; this.y=2;return \"OK\";")() !== "OK") { assert.sameValue(y, 2, 'The value of y is expected to be 2');
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');
}

View File

@ -8,18 +8,11 @@ description: >
For testing call (new Function("arg1,arg2","var x =arg1; For testing call (new Function("arg1,arg2","var x =arg1;
this.y=arg2;return arg1+arg2;"))("1",2) 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 assert.sameValue(typeof x, "undefined", 'The value of `typeof x` is expected to be "undefined"');
if ((new Function("arg1,arg2", "var x =arg1; this.y=arg2;return arg1+arg2;"))("1", 2) !== "12") { assert.sameValue(y, 2, 'The value of y is expected to be 2');
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');
}

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 FACTORY = Function("var x =1; this.y=2;return \"OK\";");
var obj = new FACTORY; var obj = new FACTORY;
//CHECK#1 assert.sameValue(typeof obj, "object", 'The value of `typeof obj` is expected to be "object"');
if (typeof obj !== "object") { assert.sameValue(obj.constructor, FACTORY, 'The value of obj.constructor is expected to equal the value of FACTORY');
throw new Test262Error('#1: every function instance has a [[Construct]] property'); assert.sameValue(obj.y, 2, 'The value of obj.y is expected to be 2');
}
//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');
}

View File

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

View File

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

View File

@ -10,11 +10,11 @@ es5id: 15.3_A2_T1
description: Checking if executing "Function.call(this, "var x / = 1;")" fails description: Checking if executing "Function.call(this, "var x / = 1;")" fails
---*/ ---*/
//CHECK#
try { try {
Function.call(this, "var x / = 1;"); Function.call(this, "var x / = 1;");
} catch (e) { } catch (e) {
if (!(e instanceof SyntaxError)) { assert(
throw new Test262Error('#1: function body must be valid'); 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 description: Checking if executing "Function.call(this, "var #x = 1;")" fails
---*/ ---*/
//CHECK#
try { try {
Function.call(this, "var #x = 1;"); Function.call(this, "var #x = 1;");
} catch (e) { } catch (e) {
if (!(e instanceof SyntaxError)) { assert(
throw new Test262Error('#1: function body must be valid'); 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 description: First argument is object
---*/ ---*/
//CHECK#1 - does not throw
var f = Function.call(mars, "return name;"); var f = Function.call(mars, "return name;");
var mars = { var mars = {
name: "mars", name: "mars",
@ -21,12 +20,8 @@ var f = Function.call(mars, "this.godname=\"ares\"; return this.color;");
var about_mars = f(); var about_mars = f();
//CHECK#2 assert.sameValue(about_mars, undefined);
if (about_mars !== undefined) {
throw new Test262Error('#2: When applied to the Function object itself, thisArg should be ignored');
}
//CHECK#3
if (this.godname !== "ares" && mars.godname === undefined) { if (this.godname !== "ares" && mars.godname === undefined) {
throw new Test262Error('#3: When applied to the Function object itself, thisArg should be ignored'); 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;"); var f = Function.call("blablastring", "return this.color;");
//CHECK#1 assert.sameValue(f(), "red", 'f() must return "red"');
if (f() !== "red") {
throw new Test262Error('#1: ');
}
var g = Function.call(null, "return this.planet;"); var g = Function.call(null, "return this.planet;");
//CHECK#2 assert.sameValue(g(), "mars", 'g() must return "mars"');
if (g() !== "mars") {
throw new Test262Error('#2: ');
}

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 f = Function.call(this, "return planet;");
var g = Function.call(this, "return color;"); var g = Function.call(this, "return color;");
//CHECK#1 assert.sameValue(f(), undefined, 'f() returns undefined');
if (f() !== undefined) {
throw new Test262Error('#1: ');
}
var planet = "mars"; var planet = "mars";
//CHECK#2 assert.sameValue(f(), "mars", 'f() must return "mars"');
if (f() !== "mars") {
throw new Test262Error('#2: ');
}
//CHECK#3
try { try {
g(); g();
throw new Test262Error('#3: '); throw new Test262Error('#3: ');
} catch (e) { } catch (e) {
if (!(e instanceof ReferenceError)) assert(
throw new Test262Error('#3.1: '); e instanceof ReferenceError,
'The result of evaluating (e instanceof ReferenceError) is expected to be true'
);
} }
this.color = "red"; this.color = "red";
//CHECK#4 assert.sameValue(g(), "red", 'g() must return "red"');
if (g() !== "red") {
throw new Test262Error('#4: ');
}

View File

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

View File

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

View File

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

View File

@ -18,4 +18,4 @@ info: |
assert.throws(SyntaxError, function() { 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() { assert.throws(TypeError, function() {
return func.caller; return func.caller;
}); }, 'return func.caller throws a TypeError exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
func.caller = {}; func.caller = {};
}); }, 'func.caller = {} throws a TypeError exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
return func.arguments; return func.arguments;
}); }, 'return func.arguments throws a TypeError exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
func.arguments = {}; func.arguments = {};
}); }, 'func.arguments = {} throws a TypeError exception');
var newfunc = new Function('"use strict"'); 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('caller'), false, 'newfunc.hasOwnProperty(\'caller\') must return false');
assert.sameValue(newfunc.hasOwnProperty('arguments'), false, 'strict Functions created using Function constructor do not have own property "arguments"'); assert.sameValue(newfunc.hasOwnProperty('arguments'), false, 'newfunc.hasOwnProperty(\'arguments\') must return false');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
return newfunc.caller; return newfunc.caller;
}); }, 'return newfunc.caller throws a TypeError exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
newfunc.caller = {}; newfunc.caller = {};
}); }, 'newfunc.caller = {} throws a TypeError exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
return newfunc.arguments; return newfunc.arguments;
}); }, 'return newfunc.arguments throws a TypeError exception');
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
newfunc.arguments = {}; 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); var f = new Function("arg1,arg2,arg3", null);
//CHECK#1 assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true');
if (!(f.hasOwnProperty('length'))) { assert.sameValue(f.length, 3, 'The value of f.length is expected to be 3');
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');
}

View File

@ -13,12 +13,5 @@ description: >
var f = Function("arg1,arg2,arg3", "arg4,arg5", null); var f = Function("arg1,arg2,arg3", "arg4,arg5", null);
//CHECK#1 assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true');
if (!(f.hasOwnProperty('length'))) { assert.sameValue(f.length, 5, 'The value of f.length is expected to be 5');
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');
}

View File

@ -13,12 +13,5 @@ description: >
var f = new Function("arg1,arg2,arg3", "arg1,arg2", "arg3", null); var f = new Function("arg1,arg2,arg3", "arg1,arg2", "arg3", null);
//CHECK#1 assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true');
if (!(f.hasOwnProperty('length'))) { assert.sameValue(f.length, 6, 'The value of f.length is expected to be 6');
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');
}

View File

@ -11,22 +11,9 @@ description: >
var f = new Function("arg1,arg2,arg3", null); var f = new Function("arg1,arg2,arg3", null);
//CHECK#1 assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true');
if (!(f.hasOwnProperty('length'))) { assert(delete f.length, 'The value of delete f.length is expected to be true');
throw new Test262Error('#1: the function has length property.'); 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 // TODO: Convert to verifyProperty() format.
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 }');
}

View File

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

View File

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

View File

@ -12,29 +12,25 @@ includes: [propertyHelper.js]
var f = new Function("arg1,arg2,arg3", "arg4,arg5", null); var f = new Function("arg1,arg2,arg3", "arg4,arg5", null);
//CHECK#1 assert(f.hasOwnProperty('length'));
if (!(f.hasOwnProperty('length'))) {
throw new Test262Error('#1: the function has length property.');
}
var flength = f.length; var flength = f.length;
verifyNotWritable(f, "length", null, function() {}); verifyNotWritable(f, "length", null, function() {});
//CHECK#2 assert.sameValue(f.length, flength);
if (f.length !== flength) {
throw new Test262Error('#2: the function.length property has the attributes ReadOnly');
}
//CHECK#3
try { try {
f.length(); f.length();
throw new Test262Error('#3: the function.length property has the attributes ReadOnly'); throw new Test262Error('#3: the function.length property has the attributes ReadOnly');
} catch (e) { } catch (e) {
if (e instanceof Test262Error) throw e; if (e instanceof Test262Error) {
throw e;
}
} }
//CHECK#4
if (f.length !== 5) { if (f.length !== 5) {
throw new Test262Error('#4: the length property has the attributes { ReadOnly }'); 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); var f = Function("arg1,arg2,arg3", null);
//CHECK#1 assert(f.hasOwnProperty('length'));
if (!(f.hasOwnProperty('length'))) {
throw new Test262Error('#1: the function has length property.');
}
var flength = f.length; var flength = f.length;
verifyNotWritable(f, "length", null, function() {}); verifyNotWritable(f, "length", null, function() {});
//CHECK#2 assert.sameValue(f.length, flength);
if (f.length !== flength) {
throw new Test262Error('#2: the function.length property has the attributes ReadOnly');
}
//CHECK#3
try { try {
f.length(); f.length();
throw new Test262Error('#3: the function.length property has the attributes ReadOnly'); throw new Test262Error('#3: the function.length property has the attributes ReadOnly');
} catch (e) { } catch (e) {
if (e instanceof Test262Error) throw e; if (e instanceof Test262Error) {
throw e;
}
} }
//CHECK#4
if (f.length !== 3) { if (f.length !== 3) {
throw new Test262Error('#4: the length property has the attributes { ReadOnly }'); 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); var f = new Function("arg1,arg2,arg3", "arg1,arg2", "arg3", null);
//CHECK#1 assert(f.hasOwnProperty('length'));
if (!(f.hasOwnProperty('length'))) {
throw new Test262Error('#1: the function has length property.');
}
var flength = f.length; var flength = f.length;
verifyNotWritable(f, "length", null, function() {}); verifyNotWritable(f, "length", null, function() {});
//CHECK#2 assert.sameValue(f.length, flength);
if (f.length !== flength) {
throw new Test262Error('#2: the function.length property has the attributes ReadOnly');
}
//CHECK#3
try { try {
f.length(); f.length();
throw new Test262Error('#3: the function.length property has the attributes ReadOnly'); throw new Test262Error('#3: the function.length property has the attributes ReadOnly');
} catch (e) { } catch (e) {
if (e instanceof Test262Error) throw e; if (e instanceof Test262Error) {
throw e;
}
} }
//CHECK#4
if (f.length !== 6) { if (f.length !== 6) {
throw new Test262Error('#4: the length property has the attributes { ReadOnly }'); 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); var f = new Function("arg1,arg2,arg3", null);
//CHECK#1 assert(f.hasOwnProperty('length'), 'f.hasOwnProperty(\'length\') must return true');
if (!(f.hasOwnProperty('length'))) {
throw new Test262Error('#1: the function has length property.');
}
for (var key in f) { for (var key in f) {
if (key == "length") { if (key == "length") {
var lengthenumed = true; var lengthenumed = true;
} }
} }
//CHECK#2 assert(!lengthenumed, 'The value of !lengthenumed is expected to be true');
if (lengthenumed) {
throw new Test262Error('#2: the length property has the attributes { DontEnum }'); // TODO: Convert to verifyProperty() format.
}

View File

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

View File

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

View File

@ -14,16 +14,12 @@ verifyNotWritable(Function, "prototype", null, function() {
return "shifted"; return "shifted";
}); });
//CHECK#1 assert.sameValue(Function.prototype, obj, 'The value of Function.prototype is expected to equal the value of obj');
if (Function.prototype !== obj) {
throw new Test262Error('#1: the Function.prototype property has the attributes ReadOnly.');
}
//CHECK#2
try { try {
if (Function.prototype() !== undefined) { assert.sameValue(Function.prototype(), undefined, 'Function.prototype() returns undefined');
throw new Test262Error('#2: the Function.prototype property has the attributes ReadOnly');
}
} catch (e) { } catch (e) {
throw new Test262Error('#2.1: the Function.prototype property has the attributes ReadOnly: ' + 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 es5id: 15.3.3.1_A2
description: Checking if enumerating the Function.prototype property fails description: Checking if enumerating the Function.prototype property fails
---*/ ---*/
assert(
// CHECK#1 !Function.propertyIsEnumerable('prototype'),
if (Function.propertyIsEnumerable('prototype')) { 'The value of !Function.propertyIsEnumerable(\'prototype\') is expected to be true'
throw new Test262Error('#1: the Function.prototype property has the attributes DontEnum'); );
}
// CHECK#2 // CHECK#2
var count = 0; var count = 0;
for (var p in Function) { for (var p in Function) {
if (p === "prototype") count++; if (p === "prototype") {
count++;
}
} }
if (count !== 0) { assert.sameValue(count, 0, 'The value of count is expected to be 0');
throw new Test262Error('#2: the Function.prototype property has the attributes DontEnum');
} // TODO: Convert to verifyProperty() format.

View File

@ -10,17 +10,17 @@ includes: [propertyHelper.js]
verifyNotConfigurable(Function, "prototype"); verifyNotConfigurable(Function, "prototype");
//CHECK#1
try { try {
if ((delete Function.prototype) !== false) { assert.sameValue(delete Function.prototype, false);
throw new Test262Error('#1: Function.prototype has the attribute DontDelete');
}
} catch (e) { } catch (e) {
if (e instanceof Test262Error) throw e; if (e instanceof Test262Error) {
throw e;
}
assert(e instanceof TypeError); assert(e instanceof TypeError);
} }
//CHECK#2
if (!(Function.hasOwnProperty('prototype'))) { if (!(Function.hasOwnProperty('prototype'))) {
throw new Test262Error('#2: the Function.prototype property has the attributes DontDelete.'); 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', { Object.defineProperty(foo, 'prototype', {
value: {} value: {}
}); });
if (foo.prototype !==
Object.getOwnPropertyDescriptor(foo, 'prototype').value) { assert.sameValue(
throw new Test262Error("A function.prototype's descriptor lies"); 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 es5id: 15.3.4_A1
description: Object.prototype.toString returns [object+[[Class]]+] description: Object.prototype.toString returns [object+[[Class]]+]
---*/ ---*/
assert.sameValue(
if (Object.prototype.toString.call(Function.prototype) !== "[object Function]") { Object.prototype.toString.call(Function.prototype),
throw new Test262Error('#2: The Function prototype object is itself a Function ' + "[object Function]",
'object (its [[Class]] is "Function") (15.3.4)'); '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() description: Call Function.prototype()
---*/ ---*/
//CHECK#1
try { try {
if (Function.prototype() !== undefined) { assert.sameValue(Function.prototype(), undefined, 'Function.prototype() returns undefined');
throw new Test262Error('#1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined');
}
} catch (e) { } 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); 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) description: Call Function.prototype(null,void 0)
---*/ ---*/
//CHECK#1
try { try {
if (Function.prototype(null, void 0) !== undefined) { assert.sameValue(Function.prototype(null, void 0), undefined, 'Function.prototype(null, void 0) returns undefined');
throw new Test262Error('#1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined');
}
} catch (e) { } 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); 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 description: Call Function.prototype(x), where x is undefined variable
---*/ ---*/
//CHECK#1 var x;
try { assert.sameValue(Function.prototype(x), undefined, 'Function.prototype(x) returns undefined');
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);
}

View File

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

View File

@ -13,7 +13,4 @@ description: >
Object.prototype.indicator = 1; Object.prototype.indicator = 1;
//CHECK#1 assert.sameValue(Function.prototype.indicator, 1, 'The value of Function.prototype.indicator is expected to be 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)');
}

View File

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

View File

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

View File

@ -12,26 +12,23 @@ includes: [propertyHelper.js]
var f = new Function("", null); var f = new Function("", null);
//CHECK#1 assert(f.hasOwnProperty('prototype'));
if (!(f.hasOwnProperty('prototype'))) {
throw new Test262Error('#1: the function has length property.');
}
var fproto = f.prototype; var fproto = f.prototype;
verifyNotConfigurable(f, "prototype"); verifyNotConfigurable(f, "prototype");
//CHECK#2
try { try {
if ((delete f.prototype) !== false) { assert.sameValue(delete f.prototype, false);
throw new Test262Error('#2: the prototype property has the attributes { DontDelete }');
}
} catch (e) { } catch (e) {
if (e instanceof Test262Error) throw e; if (e instanceof Test262Error) {
throw e;
}
assert(e instanceof TypeError); assert(e instanceof TypeError);
} }
//CHECK#3
if (f.prototype !== fproto) { if (f.prototype !== fproto) {
throw new Test262Error('#3: the prototype property has the attributes { DontDelete }'); 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, ""); var f = Function(void 0, "");
//CHECK#1 assert(f.hasOwnProperty('prototype'));
if (!(f.hasOwnProperty('prototype'))) {
throw new Test262Error('#1: the function has length property.');
}
var fproto = f.prototype; var fproto = f.prototype;
verifyNotConfigurable(f, "prototype"); verifyNotConfigurable(f, "prototype");
//CHECK#2
try { try {
if ((delete f.prototype) !== false) { assert.sameValue(delete f.prototype, false);
throw new Test262Error('#2: the prototype property has the attributes { DontDelete }');
}
} catch (e) { } catch (e) {
if (e instanceof Test262Error) throw e; if (e instanceof Test262Error) {
throw e;
}
assert(e instanceof TypeError); assert(e instanceof TypeError);
} }
//CHECK#3
if (f.prototype !== fproto) { if (f.prototype !== fproto) {
throw new Test262Error('#3: the prototype property has the attributes { DontDelete }'); 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 Checking if obtaining the prototype property of
Function.prototype.apply fails Function.prototype.apply fails
---*/ ---*/
assert.sameValue(
//CHECK#1 Function.prototype.apply.prototype,
if (Function.prototype.apply.prototype !== undefined) { undefined,
throw new Test262Error('#1: Function.prototype.apply has not prototype property' + Function.prototype.apply.prototype); 'The value of Function.prototype.apply.prototype is expected to equal undefined'
} );

View File

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

View File

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

View File

@ -11,7 +11,4 @@ description: Not any arguments at apply function
Function("this.field=\"strawberry\"").apply(); Function("this.field=\"strawberry\"").apply();
//CHECK#1 assert.sameValue(this["field"], "strawberry", 'The value of this["field"] is expected to be "strawberry"');
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');
}

View File

@ -12,7 +12,4 @@ flags: [noStrict]
eval(" (function(){this.feat=1}).apply()"); eval(" (function(){this.feat=1}).apply()");
//CHECK#1 assert.sameValue(this["feat"], 1, 'The value of this["feat"] is expected to be 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');
}

View File

@ -11,7 +11,4 @@ description: Argument at apply function is null
Function("this.field=\"green\"").apply(null); Function("this.field=\"green\"").apply(null);
//CHECK#1 assert.sameValue(this["field"], "green", 'The value of this["field"] is expected to be "green"');
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');
}

View File

@ -11,7 +11,4 @@ description: Argument at apply function is void 0
Function("this.field=\"battle\"").apply(void 0); Function("this.field=\"battle\"").apply(void 0);
//CHECK#1 assert.sameValue(this["field"], "battle", 'The value of this["field"] is expected to be "battle"');
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');
}

View File

@ -11,7 +11,4 @@ description: Argument at apply function is undefined
Function("this.field=\"oil\"").apply(undefined); Function("this.field=\"oil\"").apply(undefined);
//CHECK#1 assert.sameValue(this["field"], "oil", 'The value of this["field"] is expected to be "oil"');
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');
}

View File

@ -13,16 +13,9 @@ description: >
function FACTORY() { function FACTORY() {
Function("this.feat=\"in da haus\"").apply(); Function("this.feat=\"in da haus\"").apply();
}; }
var obj = new FACTORY; var obj = new FACTORY;
//CHECK#1 assert.sameValue(this["feat"], "in da haus", 'The value of this["feat"] is expected to be "in da haus"');
if (this["feat"] !== "in da haus") { assert.sameValue(typeof obj.feat, "undefined", 'The value of `typeof obj.feat` is expected to be "undefined"');
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');
}

View File

@ -16,16 +16,9 @@ function FACTORY() {
(function() { (function() {
this.feat = "kamon beyba" this.feat = "kamon beyba"
}).apply(null); }).apply(null);
}; }
var obj = new FACTORY; var obj = new FACTORY;
//CHECK#1 assert.sameValue(this["feat"], "kamon beyba", 'The value of this["feat"] is expected to be "kamon beyba"');
if (this["feat"] !== "kamon beyba") { assert.sameValue(typeof obj.feat, "undefined", 'The value of `typeof obj.feat` is expected to be "undefined"');
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');
}

View File

@ -16,7 +16,4 @@ description: >
})(); })();
//CHECK#1 assert.sameValue(this["feat"], "in da haus", 'The value of this["feat"] is expected to be "in da haus"');
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');
}

View File

@ -18,7 +18,4 @@ flags: [noStrict]
}).apply(undefined); }).apply(undefined);
})(); })();
//CHECK#1 assert.sameValue(this["feat"], "kamon beyba", 'The value of this["feat"] is expected to be "kamon beyba"');
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');
}

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) "); eval(" Function(\"this.feat=1\").apply(void 0) ");
//CHECK#1 assert.sameValue(this["feat"], 1, 'The value of this["feat"] is expected to be 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');
}

View File

@ -13,12 +13,5 @@ var obj = 1;
var retobj = Function("this.touched= true; return this;").apply(obj); var retobj = Function("this.touched= true; return this;").apply(obj);
//CHECK#1 assert.sameValue(typeof obj.touched, "undefined", 'The value of `typeof obj.touched` is expected to be "undefined"');
if (typeof obj.touched !== "undefined") { assert(retobj["touched"], 'The value of retobj["touched"] is expected to be true');
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');
}

View File

@ -13,12 +13,5 @@ var obj = true;
var retobj = new Function("this.touched= true; return this;").apply(obj); var retobj = new Function("this.touched= true; return this;").apply(obj);
//CHECK#1 assert.sameValue(typeof obj.touched, "undefined", 'The value of `typeof obj.touched` is expected to be "undefined"');
if (typeof obj.touched !== "undefined") { assert(retobj["touched"], 'The value of retobj["touched"] is expected to be true');
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');
}

View File

@ -17,12 +17,5 @@ var retobj = (function() {
return this; return this;
}).apply(obj); }).apply(obj);
//CHECK#1 assert.sameValue(typeof obj.touched, "undefined", 'The value of `typeof obj.touched` is expected to be "undefined"');
if (typeof obj.touched !== "undefined") { assert(retobj["touched"], 'The value of retobj["touched"] is expected to be true');
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');
}

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