mirror of https://github.com/tc39/test262.git
Replace runTestCase with assert helpers [test/language/function-code]
This commit is contained in:
parent
f939067d0e
commit
d45d495ee6
|
@ -5,11 +5,8 @@
|
|||
es5id: 10.4.3-1-1-s
|
||||
description: this is not coerced to an object in strict mode (Number)
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function foo()
|
||||
{
|
||||
'use strict';
|
||||
|
@ -22,6 +19,5 @@ function testcase() {
|
|||
}
|
||||
|
||||
|
||||
return foo.call(1) === 'number' && bar.call(1) === 'object';
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(foo.call(1), 'number', 'foo.call(1)');
|
||||
assert.sameValue(bar.call(1), 'object', 'bar.call(1)');
|
||||
|
|
|
@ -7,14 +7,11 @@ description: >
|
|||
Strict Mode - checking 'this' (FunctionExpression includes strict
|
||||
directive prologue)
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f = function () {
|
||||
"use strict";
|
||||
return typeof this;
|
||||
}
|
||||
return f() === "undefined";
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(f(), "undefined", 'f()');
|
||||
|
|
|
@ -6,10 +6,8 @@ es5id: 10.4.3-1-100-s
|
|||
description: >
|
||||
Strict Mode - checking 'this' (strict function passed as arg to
|
||||
String.prototype.replace)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var x = 3;
|
||||
|
||||
function f() {
|
||||
|
@ -17,6 +15,6 @@ function f() {
|
|||
x = this;
|
||||
return "a";
|
||||
}
|
||||
return ("ab".replace("b", f)==="aa") && (x===undefined);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue("ab".replace("b", f), "aa", '"ab".replace("b", f)');
|
||||
assert.sameValue(x, undefined, 'x');
|
||||
|
|
|
@ -7,11 +7,8 @@ description: >
|
|||
Strict Mode - checking 'this' (Function constructor defined within
|
||||
strict mode)
|
||||
flags: [onlyStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f = Function("return typeof this;");
|
||||
return f() !== "undefined";
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.notSameValue(f(), "undefined", 'f()');
|
||||
|
|
|
@ -7,11 +7,8 @@ description: >
|
|||
Strict Mode - checking 'this' (Function constructor includes
|
||||
strict directive prologue)
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f = Function("\"use strict\";\nreturn typeof this;");
|
||||
return f() === "undefined";
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(f(), "undefined", 'f()');
|
||||
|
|
|
@ -7,11 +7,8 @@ description: >
|
|||
Strict Mode - checking 'this' (New'ed Function constructor defined
|
||||
within strict mode)
|
||||
flags: [onlyStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f = new Function("return typeof this;");
|
||||
return f() !== "undefined";
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.notSameValue(f(), "undefined", 'f()');
|
||||
|
|
|
@ -7,11 +7,8 @@ description: >
|
|||
Strict Mode - checking 'this' (New'ed Function constructor
|
||||
includes strict directive prologue)
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f = new Function("\"use strict\";\nreturn typeof this;");
|
||||
return f() === "undefined";
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(f(), "undefined", 'f()');
|
||||
|
|
|
@ -5,11 +5,8 @@
|
|||
es5id: 10.4.3-1-2-s
|
||||
description: this is not coerced to an object in strict mode (string)
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function foo()
|
||||
{
|
||||
'use strict';
|
||||
|
@ -22,6 +19,5 @@ function testcase() {
|
|||
}
|
||||
|
||||
|
||||
return foo.call('1') === 'string' && bar.call('1') === 'object';
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(foo.call('1'), 'string', 'foo.call("1")');
|
||||
assert.sameValue(bar.call('1'), 'object', 'bar.call("1")');
|
||||
|
|
|
@ -7,15 +7,12 @@ description: >
|
|||
Strict Mode - checking 'this' (New'ed object from
|
||||
FunctionDeclaration defined within strict mode)
|
||||
flags: [onlyStrict]
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() {
|
||||
return this;
|
||||
}
|
||||
return ( (new f())!==fnGlobalObject()) && (typeof (new f()) !== "undefined");
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.notSameValue((new f()), fnGlobalObject(), '(new f())');
|
||||
assert.notSameValue(typeof (new f()), "undefined", 'typeof (new f())');
|
||||
|
|
|
@ -7,17 +7,13 @@ description: >
|
|||
Strict Mode - checking 'this' (New'ed object from
|
||||
FunctionDeclaration includes strict directive prologue)
|
||||
flags: [noStrict]
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() {
|
||||
"use strict";
|
||||
return this;
|
||||
}
|
||||
return ( (new f())!==fnGlobalObject()) && (typeof (new f()) !== "undefined");
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.notSameValue((new f()), fnGlobalObject(), '(new f())');
|
||||
assert.notSameValue(typeof (new f()), "undefined", 'typeof (new f())');
|
||||
|
|
|
@ -7,16 +7,12 @@ description: >
|
|||
Strict Mode - checking 'this' (New'ed object from
|
||||
FunctionExpression defined within strict mode)
|
||||
flags: [onlyStrict]
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f = function () {
|
||||
return this;
|
||||
}
|
||||
return ( (new f())!==fnGlobalObject()) && (typeof (new f()) !== "undefined");
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.notSameValue((new f()), fnGlobalObject(), '(new f())');
|
||||
assert.notSameValue(typeof (new f()), "undefined", 'typeof (new f())');
|
||||
|
|
|
@ -7,16 +7,13 @@ description: >
|
|||
Strict Mode - checking 'this' (New'ed object from
|
||||
FunctionExpression includes strict directive prologue)
|
||||
flags: [noStrict]
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f = function () {
|
||||
"use strict";
|
||||
return this;
|
||||
}
|
||||
return ( (new f())!==fnGlobalObject()) && (typeof (new f()) !== "undefined");
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.notSameValue((new f()), fnGlobalObject(), '(new f())');
|
||||
assert.notSameValue(typeof (new f()), "undefined", 'typeof (new f())');
|
||||
|
|
|
@ -7,15 +7,12 @@ description: >
|
|||
Strict Mode - checking 'this' (New'ed object from Anonymous
|
||||
FunctionExpression defined within strict mode)
|
||||
flags: [onlyStrict]
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = new (function () {
|
||||
return this;
|
||||
});
|
||||
return (obj !== fnGlobalObject()) && ((typeof obj) !== "undefined");
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.notSameValue(obj, fnGlobalObject(), 'obj');
|
||||
assert.notSameValue((typeof obj), "undefined", '(typeof obj)');
|
||||
|
|
|
@ -7,16 +7,13 @@ description: >
|
|||
Strict Mode - checking 'this' (New'ed object from Anonymous
|
||||
FunctionExpression includes strict directive prologue)
|
||||
flags: [noStrict]
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var obj = new (function () {
|
||||
"use strict";
|
||||
return this;
|
||||
});
|
||||
return (obj !== fnGlobalObject()) && ((typeof obj) !== "undefined");
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.notSameValue(obj, fnGlobalObject(), 'obj');
|
||||
assert.notSameValue((typeof obj), "undefined", '(typeof obj)');
|
||||
|
|
|
@ -7,16 +7,13 @@ description: >
|
|||
Strict Mode - checking 'this' (FunctionDeclaration defined within
|
||||
a FunctionDeclaration inside strict mode)
|
||||
flags: [onlyStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f1() {
|
||||
function f() {
|
||||
return typeof this;
|
||||
}
|
||||
return (f()==="undefined") && ((typeof this)==="undefined");
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -7,16 +7,13 @@ description: >
|
|||
Strict Mode - checking 'this' (FunctionExpression defined within a
|
||||
FunctionDeclaration inside strict mode)
|
||||
flags: [onlyStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f1() {
|
||||
var f = function () {
|
||||
return typeof this;
|
||||
}
|
||||
return (f()==="undefined") && ((typeof this)==="undefined");
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -7,15 +7,12 @@ description: >
|
|||
Strict Mode - checking 'this' (Anonymous FunctionExpression
|
||||
defined within a FunctionDeclaration inside strict mode)
|
||||
flags: [onlyStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f1() {
|
||||
return ((function () {
|
||||
return typeof this;
|
||||
})()==="undefined") && ((typeof this)==="undefined");
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -5,11 +5,8 @@
|
|||
es5id: 10.4.3-1-3-s
|
||||
description: this is not coerced to an object in strict mode (undefined)
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function foo()
|
||||
{
|
||||
'use strict';
|
||||
|
@ -20,6 +17,6 @@ function testcase() {
|
|||
{
|
||||
return typeof(this);
|
||||
}
|
||||
return foo.call(undefined) === 'undefined' && bar.call() === 'object';
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(foo.call(undefined), 'undefined', 'foo.call(undefined)');
|
||||
assert.sameValue(bar.call(), 'object', 'bar.call()');
|
||||
|
|
|
@ -7,16 +7,13 @@ description: >
|
|||
Strict Mode - checking 'this' (FunctionDeclaration defined within
|
||||
a FunctionExpression inside strict mode)
|
||||
flags: [onlyStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f1 = function () {
|
||||
function f() {
|
||||
return typeof this;
|
||||
}
|
||||
return (f()==="undefined") && ((typeof this)==="undefined");
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -7,16 +7,13 @@ description: >
|
|||
Strict Mode - checking 'this' (FunctionExpression defined within a
|
||||
FunctionExpression inside strict mode)
|
||||
flags: [onlyStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f1 = function () {
|
||||
var f = function () {
|
||||
return typeof this;
|
||||
}
|
||||
return (f()==="undefined") && ((typeof this)==="undefined");
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -7,15 +7,12 @@ description: >
|
|||
Strict Mode - checking 'this' (Anonymous FunctionExpression
|
||||
defined within a FunctionExpression inside strict mode)
|
||||
flags: [onlyStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f1 = function () {
|
||||
return ((function () {
|
||||
return typeof this;
|
||||
})()==="undefined") && ((typeof this)==="undefined");
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -7,10 +7,8 @@ description: >
|
|||
Strict Mode - checking 'this' (FunctionDeclaration defined within
|
||||
a FunctionDeclaration with a strict directive prologue)
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f1() {
|
||||
"use strict";
|
||||
function f() {
|
||||
|
@ -18,6 +16,5 @@ function f1() {
|
|||
}
|
||||
return (f()==="undefined") && ((typeof this)==="undefined");
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -7,10 +7,8 @@ description: >
|
|||
Strict Mode - checking 'this' (FunctionExpression defined within a
|
||||
FunctionDeclaration with a strict directive prologue)
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f1() {
|
||||
"use strict";
|
||||
var f = function () {
|
||||
|
@ -18,6 +16,5 @@ function f1() {
|
|||
}
|
||||
return (f()==="undefined") && ((typeof this)==="undefined");
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -8,16 +8,13 @@ description: >
|
|||
defined within a FunctionDeclaration with a strict directive
|
||||
prologue)
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f1() {
|
||||
"use strict";
|
||||
return ((function () {
|
||||
return typeof this;
|
||||
})()==="undefined") && ((typeof this)==="undefined");
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -7,10 +7,8 @@ description: >
|
|||
Strict Mode - checking 'this' (FunctionDeclaration defined within
|
||||
a FunctionExpression with a strict directive prologue)
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f1 = function () {
|
||||
"use strict";
|
||||
function f() {
|
||||
|
@ -18,6 +16,5 @@ var f1 = function () {
|
|||
}
|
||||
return (f()==="undefined") && ((typeof this)==="undefined");
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -5,11 +5,8 @@
|
|||
es5id: 10.4.3-1-4-s
|
||||
description: this is not coerced to an object in strict mode (boolean)
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function foo()
|
||||
{
|
||||
'use strict';
|
||||
|
@ -22,6 +19,5 @@ function testcase() {
|
|||
}
|
||||
|
||||
|
||||
return foo.call(true) === 'boolean' && bar.call(true) === 'object';
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(foo.call(true), 'boolean', 'foo.call(true)');
|
||||
assert.sameValue(bar.call(true), 'object', 'bar.call(true)');
|
||||
|
|
|
@ -7,10 +7,8 @@ description: >
|
|||
Strict Mode - checking 'this' (FunctionExpression defined within a
|
||||
FunctionExpression with a strict directive prologue)
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f1 = function () {
|
||||
"use strict";
|
||||
var f = function () {
|
||||
|
@ -18,6 +16,5 @@ var f1 = function () {
|
|||
}
|
||||
return (f()==="undefined") && ((typeof this)==="undefined");
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -8,16 +8,13 @@ description: >
|
|||
defined within a FunctionExpression with a strict directive
|
||||
prologue)
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f1 = function () {
|
||||
"use strict";
|
||||
return ((function () {
|
||||
return typeof this;
|
||||
})()==="undefined") && ((typeof this)==="undefined");
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -7,12 +7,9 @@ description: >
|
|||
Strict Mode - checking 'this' (FunctionDeclaration with a strict
|
||||
directive prologue defined within a FunctionDeclaration)
|
||||
flags: [noStrict]
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f1() {
|
||||
function f() {
|
||||
"use strict";
|
||||
|
@ -20,6 +17,5 @@ function f1() {
|
|||
}
|
||||
return (f()==="undefined") && (this===fnGlobalObject());
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -7,12 +7,9 @@ description: >
|
|||
Strict Mode - checking 'this' (FunctionExpression with a strict
|
||||
directive prologue defined within a FunctionDeclaration)
|
||||
flags: [noStrict]
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f1() {
|
||||
var f = function () {
|
||||
"use strict";
|
||||
|
@ -20,6 +17,5 @@ function f1() {
|
|||
}
|
||||
return (f()==="undefined") && (this===fnGlobalObject());
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -7,18 +7,14 @@ description: >
|
|||
Strict Mode - checking 'this' (Anonymous FunctionExpression with a
|
||||
strict directive prologue defined within a FunctionDeclaration)
|
||||
flags: [noStrict]
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f1() {
|
||||
return ((function () {
|
||||
"use strict";
|
||||
return typeof this;
|
||||
})()==="undefined") && (this===fnGlobalObject());
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -7,12 +7,9 @@ description: >
|
|||
Strict Mode - checking 'this' (FunctionDeclaration with a strict
|
||||
directive prologue defined within a FunctionExpression)
|
||||
flags: [noStrict]
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f1 = function () {
|
||||
function f() {
|
||||
"use strict";
|
||||
|
@ -20,6 +17,5 @@ var f1 = function () {
|
|||
}
|
||||
return (f()==="undefined") && (this===fnGlobalObject());
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -7,12 +7,9 @@ description: >
|
|||
Strict Mode - checking 'this' (FunctionExpression with a strict
|
||||
directive prologue defined within a FunctionExpression)
|
||||
flags: [noStrict]
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f1 = function () {
|
||||
var f = function () {
|
||||
"use strict";
|
||||
|
@ -20,6 +17,5 @@ var f1 = function () {
|
|||
}
|
||||
return (f()==="undefined") && (this===fnGlobalObject());
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -4,11 +4,8 @@
|
|||
/*---
|
||||
es5id: 10.4.3-1-5-s
|
||||
description: this is not coerced to an object (function)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function foo()
|
||||
{
|
||||
'use strict';
|
||||
|
@ -24,6 +21,5 @@ function testcase() {
|
|||
{
|
||||
}
|
||||
|
||||
return foo.call(foobar) === 'function' && bar.call(foobar) === 'function';
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(foo.call(foobar), 'function', 'foo.call(foobar)');
|
||||
assert.sameValue(bar.call(foobar), 'function', 'bar.call(foobar)');
|
||||
|
|
|
@ -7,18 +7,14 @@ description: >
|
|||
Strict Mode - checking 'this' (Anonymous FunctionExpression with a
|
||||
strict directive prologue defined within a FunctionExpression)
|
||||
flags: [noStrict]
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f1 = function () {
|
||||
return ((function () {
|
||||
"use strict";
|
||||
return typeof this;
|
||||
})()==="undefined") && (this===fnGlobalObject());
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f1(), 'f1() !== true');
|
||||
|
|
|
@ -5,11 +5,8 @@
|
|||
es5id: 10.4.3-1-54-s
|
||||
description: >
|
||||
checking 'this' (Literal getter)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var o = { get foo() { return this; } }
|
||||
return o.foo===o;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(o.foo, o, 'o.foo');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 10.4.3-1-55-s
|
|||
description: >
|
||||
Strict Mode - checking 'this' (Literal getter includes strict
|
||||
directive prologue)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var o = { get foo() { "use strict"; return this; } }
|
||||
return o.foo===o;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(o.foo, o, 'o.foo');
|
||||
|
|
|
@ -5,13 +5,10 @@
|
|||
es5id: 10.4.3-1-56-s
|
||||
description: >
|
||||
checking 'this' (Literal setter)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var x = 2;
|
||||
var o = { set foo(stuff) { x=this; } }
|
||||
o.foo = 3;
|
||||
return x===o;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(x, o, 'x');
|
||||
|
|
|
@ -5,13 +5,10 @@
|
|||
es5id: 10.4.3-1-57-s
|
||||
description: >
|
||||
checking 'this' (Literal setter includes strict directive prologue)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var x = 2;
|
||||
var o = { set foo(stuff) { "use strict"; x=this; } }
|
||||
o.foo = 3;
|
||||
return x===o;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(x, o, 'x');
|
||||
|
|
|
@ -5,12 +5,9 @@
|
|||
es5id: 10.4.3-1-58-s
|
||||
description: >
|
||||
checking 'this' (Injected getter)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var o = {};
|
||||
Object.defineProperty(o, "foo", { get: function() { return this; } });
|
||||
return o.foo===o;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(o.foo, o, 'o.foo');
|
||||
|
|
|
@ -5,12 +5,9 @@
|
|||
es5id: 10.4.3-1-59-s
|
||||
description: >
|
||||
checking 'this' (Injected getter includes strict directive prologue)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var o = {};
|
||||
Object.defineProperty(o, "foo", { get: function() { "use strict"; return this; } });
|
||||
return o.foo===o;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(o.foo, o, 'o.foo');
|
||||
|
|
|
@ -5,14 +5,11 @@
|
|||
es5id: 10.4.3-1-60-s
|
||||
description: >
|
||||
checking 'this' (Injected setter)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var o = {};
|
||||
var x = 2;
|
||||
Object.defineProperty(o, "foo", { set: function(stuff) { x=this; } });
|
||||
o.foo = 3;
|
||||
return x===o;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(x, o, 'x');
|
||||
|
|
|
@ -5,14 +5,11 @@
|
|||
es5id: 10.4.3-1-61-s
|
||||
description: >
|
||||
checking 'this' (Injected setter includes strict directive prologue)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var o = {};
|
||||
var x = 2;
|
||||
Object.defineProperty(o, "foo", { set: function(stuff) { "use strict"; x=this; } });
|
||||
o.foo = 3;
|
||||
return x===o;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(x, o, 'x');
|
||||
|
|
|
@ -6,12 +6,9 @@ es5id: 10.4.3-1-62-s
|
|||
description: >
|
||||
checking 'this' (strict function declaration called by non-strict function
|
||||
declaration)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() { "use strict"; return this;};
|
||||
function foo() { return f();}
|
||||
return foo()===undefined;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(foo(), undefined, 'foo()');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 10.4.3-1-66-s
|
|||
description: >
|
||||
checking 'this' (strict function declaration called by
|
||||
Function.prototype.apply())
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() { "use strict"; return this===undefined;};
|
||||
return f.apply();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f.apply(), 'f.apply() !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 10.4.3-1-67-s
|
|||
description: >
|
||||
checking 'this' (strict function declaration called by
|
||||
Function.prototype.apply(null))
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() { "use strict"; return this===null;};
|
||||
return f.apply(null);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f.apply(null), 'f.apply(null) !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 10.4.3-1-68-s
|
|||
description: >
|
||||
checking 'this' (strict function declaration called by
|
||||
Function.prototype.apply(undefined))
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() { "use strict"; return this===undefined;};
|
||||
return f.apply(undefined);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f.apply(undefined), 'f.apply(undefined) !== true');
|
||||
|
|
|
@ -6,12 +6,9 @@ es5id: 10.4.3-1-69-s
|
|||
description: >
|
||||
checking 'this' (strict function declaration called by
|
||||
Function.prototype.apply(someObject))
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var o = {};
|
||||
function f() { "use strict"; return this===o;};
|
||||
return f.apply(o);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f.apply(o), 'f.apply(o) !== true');
|
||||
|
|
|
@ -7,13 +7,10 @@ description: >
|
|||
Strict Mode - checking 'this' (FunctionDeclaration defined within
|
||||
strict mode)
|
||||
flags: [onlyStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() {
|
||||
return typeof this;
|
||||
}
|
||||
return f() === "undefined";
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(f(), "undefined", 'f()');
|
||||
|
|
|
@ -6,13 +6,9 @@ es5id: 10.4.3-1-70-s
|
|||
description: >
|
||||
checking 'this' (strict function declaration called by
|
||||
Function.prototype.apply(globalObject))
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() { "use strict"; return this;};
|
||||
return f.apply(fnGlobalObject()) === fnGlobalObject();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(f.apply(fnGlobalObject()), fnGlobalObject(), 'f.apply(fnGlobalObject())');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 10.4.3-1-71-s
|
|||
description: >
|
||||
checking 'this' (strict function declaration called by
|
||||
Function.prototype.call())
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() { "use strict"; return this===undefined;};
|
||||
return f.call();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f.call(), 'f.call() !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 10.4.3-1-72-s
|
|||
description: >
|
||||
checking 'this' (strict function declaration called by
|
||||
Function.prototype.call(null))
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() { "use strict"; return this===null;};
|
||||
return f.call(null);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f.call(null), 'f.call(null) !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 10.4.3-1-73-s
|
|||
description: >
|
||||
checking 'this' (strict function declaration called by
|
||||
Function.prototype.call(undefined))
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() { "use strict"; return this===undefined;};
|
||||
return f.call(undefined);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f.call(undefined), 'f.call(undefined) !== true');
|
||||
|
|
|
@ -6,12 +6,9 @@ es5id: 10.4.3-1-74-s
|
|||
description: >
|
||||
checking 'this' (strict function declaration called by
|
||||
Function.prototype.call(someObject))
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var o = {};
|
||||
function f() { "use strict"; return this===o;};
|
||||
return f.call(o);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f.call(o), 'f.call(o) !== true');
|
||||
|
|
|
@ -6,13 +6,9 @@ es5id: 10.4.3-1-75-s
|
|||
description: >
|
||||
checking 'this' (strict function declaration called by
|
||||
Function.prototype.call(globalObject))
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() { "use strict"; return this;};
|
||||
return f.call(fnGlobalObject()) === fnGlobalObject();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(f.call(fnGlobalObject()), fnGlobalObject(), 'f.call(fnGlobalObject())');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 10.4.3-1-76-s
|
|||
description: >
|
||||
checking 'this' (strict function declaration called by
|
||||
Function.prototype.bind()())
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() { "use strict"; return this===undefined;};
|
||||
return f.bind()();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f.bind()(), 'f.bind()() !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 10.4.3-1-77-s
|
|||
description: >
|
||||
checking 'this' (strict function declaration called by
|
||||
Function.prototype.bind(null)())
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() { "use strict"; return this===null;};
|
||||
return f.bind(null)();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f.bind(null)(), 'f.bind(null)() !== true');
|
||||
|
|
|
@ -6,11 +6,8 @@ es5id: 10.4.3-1-78-s
|
|||
description: >
|
||||
checking 'this' (strict function declaration called by
|
||||
Function.prototype.bind(undefined)())
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() { "use strict"; return this===undefined;};
|
||||
return f.bind(undefined)();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f.bind(undefined)(), 'f.bind(undefined)() !== true');
|
||||
|
|
|
@ -6,12 +6,9 @@ es5id: 10.4.3-1-79-s
|
|||
description: >
|
||||
checking 'this' (strict function declaration called by
|
||||
Function.prototype.bind(someObject)())
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var o = {};
|
||||
function f() { "use strict"; return this===o;};
|
||||
return f.bind(o)();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(f.bind(o)(), 'f.bind(o)() !== true');
|
||||
|
|
|
@ -7,14 +7,11 @@ description: >
|
|||
Strict Mode - checking 'this' (FunctionDeclaration includes strict
|
||||
directive prologue)
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() {
|
||||
"use strict";
|
||||
return typeof this;
|
||||
}
|
||||
return f() === "undefined";
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(f(), "undefined", 'f()');
|
||||
|
|
|
@ -7,13 +7,9 @@ description: >
|
|||
Strict Mode - checking 'this' (strict function declaration called
|
||||
by Function.prototype.bind(globalObject)())
|
||||
flags: [noStrict]
|
||||
includes:
|
||||
- runTestCase.js
|
||||
- fnGlobalObject.js
|
||||
includes: [fnGlobalObject.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() { "use strict"; return this;};
|
||||
return f.bind(fnGlobalObject())() === fnGlobalObject();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(f.bind(fnGlobalObject())(), fnGlobalObject(), 'f.bind(fnGlobalObject())()');
|
||||
|
|
|
@ -7,12 +7,9 @@ description: >
|
|||
Strict Mode - checking 'this' (non-strict function declaration
|
||||
called by strict function declaration)
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function f() { return this!==undefined;};
|
||||
function foo() { "use strict"; return f();}
|
||||
return foo();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(foo(), 'foo() !== true');
|
||||
|
|
|
@ -7,13 +7,10 @@ description: >
|
|||
Strict Mode - checking 'this' (FunctionExpression defined within
|
||||
strict mode)
|
||||
flags: [onlyStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f = function () {
|
||||
return typeof this;
|
||||
}
|
||||
return f() === "undefined";
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(f(), "undefined", 'f()');
|
||||
|
|
Loading…
Reference in New Issue