Replace runTestCase with assert helpers [test/language/arguments-object]

This commit is contained in:
André Bargull 2015-08-06 18:30:42 +02:00
parent ce98c25647
commit ba8a41efe9
12 changed files with 23 additions and 62 deletions

View File

@ -4,15 +4,11 @@
/*---
es5id: 10.5-7-b-2-s
description: Arguments object index assignment is allowed
includes: [runTestCase.js]
---*/
function testcase() {
function _10_5_7_b_2_fun() {
arguments[7] = 12;
return arguments[7] === 12;
};
return _10_5_7_b_2_fun(30);
}
runTestCase(testcase);
assert(_10_5_7_b_2_fun(30), '_10_5_7_b_2_fun(30) !== true');

View File

@ -5,15 +5,11 @@
es5id: 10.5-7-b-3-s
description: >
Adding property to the arguments object successful under strict mode
includes: [runTestCase.js]
---*/
function testcase() {
function _10_5_7_b_3_fun() {
arguments[1] = 12;
return arguments[0] === 30 && arguments[1] === 12;
};
return _10_5_7_b_3_fun(30);
}
runTestCase(testcase);
assert(_10_5_7_b_3_fun(30), '_10_5_7_b_3_fun(30) !== true');

View File

@ -5,16 +5,13 @@
es5id: 10.5-7-b-4-s
description: >
Deleting property of the arguments object successful under strict mode
includes: [runTestCase.js]
---*/
function testcase() {
function _10_5_7_b_4_fun() {
var _10_5_7_b_4_1 = arguments[0] === 30 && arguments[1] === 12;
delete arguments[1];
var _10_5_7_b_4_2 = arguments[0] === 30 && typeof arguments[1] === "undefined";
return _10_5_7_b_4_1 && _10_5_7_b_4_2;
};
return _10_5_7_b_4_fun(30, 12);
}
runTestCase(testcase);
assert(_10_5_7_b_4_fun(30, 12), '_10_5_7_b_4_fun(30, 12) !== true');

View File

@ -7,15 +7,12 @@ description: >
arguments[i] remains same after changing actual parameters in
strict mode
flags: [onlyStrict]
includes: [runTestCase.js]
---*/
function testcase() {
function foo(a,b,c)
{
a = 1; b = 'str'; c = 2.1;
return (arguments[0] === 10 && arguments[1] === 'sss' && arguments[2] === 1);
}
return foo(10, 'sss', 1);
}
runTestCase(testcase);
assert(foo(10, 'sss', 1), 'foo(10, "sss", 1) !== true');

View File

@ -5,16 +5,13 @@
es5id: 10.6-10-c-ii-1
description: arguments[i] change with actual parameters
flags: [noStrict]
includes: [runTestCase.js]
---*/
function testcase() {
function foo(a,b,c)
{
a = 1; b = 'str'; c = 2.1;
if(arguments[0] === 1 && arguments[1] === 'str' && arguments[2] === 2.1)
return true;
}
return foo(10,'sss',1);
}
runTestCase(testcase);
assert(foo(10,'sss',1), 'foo(10,"sss",1) !== true');

View File

@ -5,16 +5,12 @@
es5id: 10.6-10-c-ii-2-s
description: arguments[i] doesn't map to actual parameters in strict mode
flags: [onlyStrict]
includes: [runTestCase.js]
---*/
function testcase() {
function foo(a,b,c)
{
arguments[0] = 1; arguments[1] = 'str'; arguments[2] = 2.1;
return 10 === a && 'sss' === b && 1 === c;
}
return foo(10,'sss',1);
}
runTestCase(testcase);
assert(foo(10,'sss',1), 'foo(10,"sss",1) !== true');

View File

@ -5,17 +5,13 @@
es5id: 10.6-10-c-ii-2
description: arguments[i] map to actual parameter
flags: [noStrict]
includes: [runTestCase.js]
---*/
function testcase() {
function foo(a,b,c)
{
arguments[0] = 1; arguments[1] = 'str'; arguments[2] = 2.1;
if(1 === a && 'str' === b && 2.1 === c)
return true;
}
return foo(10,'sss',1);
}
runTestCase(testcase);
assert(foo(10,'sss',1), 'foo(10,"sss",1) !== true');

View File

@ -5,10 +5,8 @@
es5id: 10.6-13-a-2
description: A direct call to arguments.callee.caller should work
flags: [noStrict]
includes: [runTestCase.js]
---*/
function testcase() {
var called = false;
function test1(flag) {
@ -28,7 +26,5 @@ function testcase() {
}
test1();
return called;
}
runTestCase(testcase);
assert(called, 'called !== true');

View File

@ -5,10 +5,8 @@
es5id: 10.6-13-a-3
description: An indirect call to arguments.callee.caller should work
flags: [noStrict]
includes: [runTestCase.js]
---*/
function testcase() {
var called = false;
function test1(flag) {
@ -29,7 +27,5 @@ function testcase() {
}
test1();
return called;
}
runTestCase(testcase);
assert(called, 'called !== true');

View File

@ -5,13 +5,11 @@
es5id: 10.6-14-1-s
description: Strict Mode - 'callee' exists and 'caller' exists under strict mode
flags: [onlyStrict]
includes: [runTestCase.js]
---*/
function testcase() {
var argObj = function () {
return arguments;
} ();
return argObj.hasOwnProperty("callee") && argObj.hasOwnProperty("caller");
}
runTestCase(testcase);
assert(argObj.hasOwnProperty("callee"), 'argObj.hasOwnProperty("callee") !== true');
assert(argObj.hasOwnProperty("caller"), 'argObj.hasOwnProperty("caller") !== true');

View File

@ -7,10 +7,8 @@ description: >
Strict Mode - [[Enumerable]] attribute value in 'caller' is false
under strict mode
flags: [onlyStrict]
includes: [runTestCase.js]
---*/
function testcase() {
var argObj = function () {
return arguments;
} ();
@ -21,6 +19,6 @@ function testcase() {
verifyEnumerable = true;
}
}
return !verifyEnumerable && argObj.hasOwnProperty("caller");
}
runTestCase(testcase);
assert.sameValue(verifyEnumerable, false, 'verifyEnumerable');
assert(argObj.hasOwnProperty("caller"), 'argObj.hasOwnProperty("caller") !== true');

View File

@ -5,10 +5,8 @@
es5id: 10.6-14-c-1-s
description: >
[[Enumerable]] attribute value in 'callee' is false
includes: [runTestCase.js]
---*/
function testcase() {
var argObj = function () {
return arguments;
} ();
@ -19,6 +17,6 @@ function testcase() {
verifyEnumerable = true;
}
}
return !verifyEnumerable && argObj.hasOwnProperty("callee");
}
runTestCase(testcase);
assert.sameValue(verifyEnumerable, false, 'verifyEnumerable');
assert(argObj.hasOwnProperty("callee"), 'argObj.hasOwnProperty("callee") !== true');