Skip to content
Snippets Groups Projects
Commit 789224fb authored by André Bargull's avatar André Bargull
Browse files

Replace runTestCase with assert helpers [test/language/function-code]

parent 73d5292b
No related branches found
No related tags found
No related merge requests found
Showing
with 59 additions and 129 deletions
...@@ -7,12 +7,9 @@ description: > ...@@ -7,12 +7,9 @@ description: >
Strict Mode - checking 'this' (non-strict function passed as arg Strict Mode - checking 'this' (non-strict function passed as arg
to String.prototype.replace from strict context) to String.prototype.replace from strict context)
flags: [noStrict] flags: [noStrict]
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
var x = 3; var x = 3;
function f() { function f() {
...@@ -20,6 +17,5 @@ function f() { ...@@ -20,6 +17,5 @@ function f() {
return "a"; return "a";
} }
return (function() {"use strict"; return "ab".replace("b", f)==="aa";}()) && (x===fnGlobalObject()); assert.sameValue(function() {"use strict"; return "ab".replace("b", f);}(), "aa");
} assert.sameValue(x, fnGlobalObject(), 'x');
runTestCase(testcase);
...@@ -6,18 +6,15 @@ es5id: 10.4.3-1-102-s ...@@ -6,18 +6,15 @@ es5id: 10.4.3-1-102-s
description: > description: >
Strict Mode - checking 'this' (strict anonymous function passed as Strict Mode - checking 'this' (strict anonymous function passed as
arg to String.prototype.replace) arg to String.prototype.replace)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var x = 3; var x = 3;
return ("ab".replace("b", (function () { assert.sameValue("ab".replace("b", (function () {
"use strict"; "use strict";
return function () { return function () {
x = this; x = this;
return "a"; return "a";
} }
})())==="aa") && (x===undefined); })()), "aa");
} assert.sameValue(x, undefined, 'x');
runTestCase(testcase);
...@@ -6,14 +6,9 @@ es5id: 10.4.3-1-103 ...@@ -6,14 +6,9 @@ es5id: 10.4.3-1-103
description: > description: >
Non strict mode should ToObject thisArg if not an object. Non strict mode should ToObject thisArg if not an object.
Abstract equality operator should succeed. Abstract equality operator should succeed.
includes: [runTestCase.js]
---*/ ---*/
function testcase(){
Object.defineProperty(Object.prototype, "x", { get: function () { return this; } }); Object.defineProperty(Object.prototype, "x", { get: function () { return this; } });
if((5).x == 0) return false;
if(!((5).x == 5)) return false;
return true;
}
runTestCase(testcase); assert.sameValue((5).x == 0, false, '(5).x == 0');
assert((5).x == 5, '(5).x == 5');
...@@ -7,13 +7,8 @@ description: > ...@@ -7,13 +7,8 @@ description: >
Strict mode should not ToObject thisArg if not an object. Strict Strict mode should not ToObject thisArg if not an object. Strict
equality operator should succeed. equality operator should succeed.
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase(){
Object.defineProperty(Object.prototype, "x", { get: function () { return this; } }); Object.defineProperty(Object.prototype, "x", { get: function () { return this; } });
if(!((5).x === 5)) return false;
return true;
}
runTestCase(testcase); assert((5).x === 5, '(5).x === 5');
...@@ -10,14 +10,9 @@ description: > ...@@ -10,14 +10,9 @@ description: >
Non strict mode should ToObject thisArg if not an object. Return Non strict mode should ToObject thisArg if not an object. Return
type should be object and strict equality should fail. type should be object and strict equality should fail.
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase(){
Object.defineProperty(Object.prototype, "x", { get: function () { return this; } }); Object.defineProperty(Object.prototype, "x", { get: function () { return this; } });
if((5).x === 5) return false;
if(!(typeof (5).x === "object")) return false;
return true;
}
runTestCase(testcase); assert.sameValue((5).x === 5, false, '(5).x === 5');
assert.sameValue(typeof (5).x, "object", 'typeof (5).x');
...@@ -10,13 +10,8 @@ description: > ...@@ -10,13 +10,8 @@ description: >
Strict mode should not ToObject thisArg if not an object. Return Strict mode should not ToObject thisArg if not an object. Return
type should be 'number'. type should be 'number'.
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase(){
Object.defineProperty(Object.prototype, "x", { get: function () { return this; } }); Object.defineProperty(Object.prototype, "x", { get: function () { return this; } });
if(!(typeof (5).x === "number")) return false;
return true;
}
runTestCase(testcase); assert.sameValue(typeof (5).x, "number", 'typeof (5).x');
...@@ -7,12 +7,8 @@ description: > ...@@ -7,12 +7,8 @@ description: >
Strict Mode - checking 'this' (Anonymous FunctionExpression Strict Mode - checking 'this' (Anonymous FunctionExpression
defined within strict mode) defined within strict mode)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue((function () {
return (function () {
return typeof this; return typeof this;
})() === "undefined"; })(), "undefined");
}
runTestCase(testcase);
...@@ -7,13 +7,9 @@ description: > ...@@ -7,13 +7,9 @@ description: >
Strict Mode - checking 'this' (Anonymous FunctionExpression Strict Mode - checking 'this' (Anonymous FunctionExpression
includes strict directive prologue) includes strict directive prologue)
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue((function () {
return (function () {
"use strict"; "use strict";
return typeof this; return typeof this;
})() === "undefined"; })(), "undefined");
}
runTestCase(testcase);
...@@ -5,12 +5,11 @@ ...@@ -5,12 +5,11 @@
es5id: 10.4.3-1-17-s es5id: 10.4.3-1-17-s
description: Strict Mode - checking 'this' (eval used within strict mode) description: Strict Mode - checking 'this' (eval used within strict mode)
flags: [onlyStrict] flags: [onlyStrict]
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() { function testcase() {
return (eval("typeof this") === "undefined") && (eval("this") !== fnGlobalObject()); assert.sameValue(eval("typeof this"), "undefined", 'eval("typeof this")');
assert.notSameValue(eval("this"), fnGlobalObject(), 'eval("this")');
} }
runTestCase(testcase); testcase();
...@@ -7,13 +7,11 @@ description: > ...@@ -7,13 +7,11 @@ description: >
Strict Mode - checking 'this' (indirect eval used within strict Strict Mode - checking 'this' (indirect eval used within strict
mode) mode)
flags: [onlyStrict] flags: [onlyStrict]
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() { function testcase() {
var my_eval = eval; var my_eval = eval;
return my_eval("this") === fnGlobalObject(); assert.sameValue(my_eval("this"), fnGlobalObject(), 'my_eval("this")');
} }
runTestCase(testcase); testcase();
...@@ -7,13 +7,11 @@ description: > ...@@ -7,13 +7,11 @@ description: >
Strict Mode - checking 'this' (indirect eval includes strict Strict Mode - checking 'this' (indirect eval includes strict
directive prologue) directive prologue)
flags: [noStrict] flags: [noStrict]
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() { function testcase() {
var my_eval = eval; var my_eval = eval;
return my_eval("\"use strict\";\nthis") === fnGlobalObject(); assert.sameValue(my_eval("\"use strict\";\nthis"), fnGlobalObject());
} }
runTestCase(testcase); testcase();
...@@ -7,15 +7,12 @@ description: > ...@@ -7,15 +7,12 @@ description: >
Strict Mode - checking 'this' (FunctionDeclaration defined within Strict Mode - checking 'this' (FunctionDeclaration defined within
an Anonymous FunctionExpression inside strict mode) an Anonymous FunctionExpression inside strict mode)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { (function () {
return (function () {
function f() { function f() {
return typeof this; return typeof this;
} }
return (f()==="undefined") && ((typeof this)==="undefined"); assert.sameValue(f(), "undefined", 'f()');
assert.sameValue(typeof this, "undefined", 'typeof this');
})(); })();
}
runTestCase(testcase);
...@@ -7,15 +7,12 @@ description: > ...@@ -7,15 +7,12 @@ description: >
Strict Mode - checking 'this' (FunctionExpression defined within Strict Mode - checking 'this' (FunctionExpression defined within
an Anonymous FunctionExpression inside strict mode) an Anonymous FunctionExpression inside strict mode)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { (function () {
return (function () {
var f = function () { var f = function () {
return typeof this; return typeof this;
} }
return (f()==="undefined") && ((typeof this)==="undefined"); assert.sameValue(f(), "undefined", 'f()');
assert.sameValue(typeof this, "undefined", 'typeof this');
})(); })();
}
runTestCase(testcase);
...@@ -7,14 +7,11 @@ description: > ...@@ -7,14 +7,11 @@ description: >
Strict Mode - checking 'this' (Anonymous FunctionExpression Strict Mode - checking 'this' (Anonymous FunctionExpression
defined within an Anonymous FunctionExpression inside strict mode) defined within an Anonymous FunctionExpression inside strict mode)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { (function () {
return (function () { assert.sameValue((function () {
return ((function () {
return typeof this; return typeof this;
})()==="undefined") && ((typeof this)==="undefined"); })(), "undefined");
assert.sameValue(typeof this, "undefined", 'typeof this');
})(); })();
}
runTestCase(testcase);
...@@ -7,16 +7,13 @@ description: > ...@@ -7,16 +7,13 @@ description: >
Strict Mode - checking 'this' (FunctionDeclaration defined within Strict Mode - checking 'this' (FunctionDeclaration defined within
an Anonymous FunctionExpression with a strict directive prologue) an Anonymous FunctionExpression with a strict directive prologue)
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { (function () {
return (function () {
"use strict"; "use strict";
function f() { function f() {
return typeof this; return typeof this;
} }
return (f()==="undefined") && ((typeof this)==="undefined"); assert.sameValue(f(), "undefined", 'f()');
assert.sameValue(typeof this, "undefined", 'typeof this');
})(); })();
}
runTestCase(testcase);
...@@ -7,16 +7,13 @@ description: > ...@@ -7,16 +7,13 @@ description: >
Strict Mode - checking 'this' (FunctionExpression defined within Strict Mode - checking 'this' (FunctionExpression defined within
an Anonymous FunctionExpression with a strict directive prologue) an Anonymous FunctionExpression with a strict directive prologue)
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { (function () {
return (function () {
"use strict"; "use strict";
var f = function () { var f = function () {
return typeof this; return typeof this;
} }
return (f()==="undefined") && ((typeof this)==="undefined"); assert.sameValue(f(), "undefined", 'f()');
assert.sameValue(typeof this, "undefined", 'typeof this');
})(); })();
}
runTestCase(testcase);
...@@ -8,15 +8,12 @@ description: > ...@@ -8,15 +8,12 @@ description: >
defined within an Anonymous FunctionExpression with a strict defined within an Anonymous FunctionExpression with a strict
directive prologue) directive prologue)
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { (function () {
return (function () {
"use strict"; "use strict";
return ((function () { assert.sameValue((function () {
return typeof this; return typeof this;
})()==="undefined") && ((typeof this)==="undefined"); })(), "undefined");
assert.sameValue(typeof this, "undefined", 'typeof this');
})(); })();
}
runTestCase(testcase);
...@@ -7,18 +7,14 @@ description: > ...@@ -7,18 +7,14 @@ description: >
Strict Mode - checking 'this' (FunctionDeclaration with a strict Strict Mode - checking 'this' (FunctionDeclaration with a strict
directive prologue defined within an Anonymous FunctionExpression) directive prologue defined within an Anonymous FunctionExpression)
flags: [noStrict] flags: [noStrict]
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() { (function () {
return (function () {
function f() { function f() {
"use strict"; "use strict";
return typeof this; return typeof this;
} }
return (f()==="undefined") && (this===fnGlobalObject()); assert.sameValue(f(), "undefined", 'f()');
assert.sameValue(this, fnGlobalObject(), 'this');
})(); })();
}
runTestCase(testcase);
...@@ -7,18 +7,14 @@ description: > ...@@ -7,18 +7,14 @@ description: >
Strict Mode - checking 'this' (FunctionExpression with a strict Strict Mode - checking 'this' (FunctionExpression with a strict
directive prologue defined within an Anonymous FunctionExpression) directive prologue defined within an Anonymous FunctionExpression)
flags: [noStrict] flags: [noStrict]
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() { (function () {
return (function () {
var f = function () { var f = function () {
"use strict"; "use strict";
return typeof this; return typeof this;
} }
return (f()==="undefined") && (this===fnGlobalObject()); assert.sameValue(f(), "undefined", 'f()');
assert.sameValue(this, fnGlobalObject(), 'this');
})(); })();
}
runTestCase(testcase);
...@@ -8,17 +8,13 @@ description: > ...@@ -8,17 +8,13 @@ description: >
strict directive prologue defined within an Anonymous strict directive prologue defined within an Anonymous
FunctionExpression) FunctionExpression)
flags: [noStrict] flags: [noStrict]
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() { (function () {
return (function () { assert.sameValue((function () {
return ((function () {
"use strict"; "use strict";
return typeof this; return typeof this;
})()==="undefined") && (this===fnGlobalObject()); })(), "undefined");
assert.sameValue(this, fnGlobalObject(), 'this');
})(); })();
}
runTestCase(testcase);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment