mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 22:15:24 +02:00
Replace runTestCase with assert helpers [test/language/arguments-object]
This commit is contained in:
parent
ce98c25647
commit
ba8a41efe9
@ -4,15 +4,11 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 10.5-7-b-2-s
|
es5id: 10.5-7-b-2-s
|
||||||
description: Arguments object index assignment is allowed
|
description: Arguments object index assignment is allowed
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function _10_5_7_b_2_fun() {
|
function _10_5_7_b_2_fun() {
|
||||||
arguments[7] = 12;
|
arguments[7] = 12;
|
||||||
return arguments[7] === 12;
|
return arguments[7] === 12;
|
||||||
};
|
};
|
||||||
|
|
||||||
return _10_5_7_b_2_fun(30);
|
assert(_10_5_7_b_2_fun(30), '_10_5_7_b_2_fun(30) !== true');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -5,15 +5,11 @@
|
|||||||
es5id: 10.5-7-b-3-s
|
es5id: 10.5-7-b-3-s
|
||||||
description: >
|
description: >
|
||||||
Adding property to the arguments object successful under strict mode
|
Adding property to the arguments object successful under strict mode
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function _10_5_7_b_3_fun() {
|
function _10_5_7_b_3_fun() {
|
||||||
arguments[1] = 12;
|
arguments[1] = 12;
|
||||||
return arguments[0] === 30 && arguments[1] === 12;
|
return arguments[0] === 30 && arguments[1] === 12;
|
||||||
};
|
};
|
||||||
|
|
||||||
return _10_5_7_b_3_fun(30);
|
assert(_10_5_7_b_3_fun(30), '_10_5_7_b_3_fun(30) !== true');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -5,16 +5,13 @@
|
|||||||
es5id: 10.5-7-b-4-s
|
es5id: 10.5-7-b-4-s
|
||||||
description: >
|
description: >
|
||||||
Deleting property of the arguments object successful under strict mode
|
Deleting property of the arguments object successful under strict mode
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function _10_5_7_b_4_fun() {
|
function _10_5_7_b_4_fun() {
|
||||||
var _10_5_7_b_4_1 = arguments[0] === 30 && arguments[1] === 12;
|
var _10_5_7_b_4_1 = arguments[0] === 30 && arguments[1] === 12;
|
||||||
delete arguments[1];
|
delete arguments[1];
|
||||||
var _10_5_7_b_4_2 = arguments[0] === 30 && typeof arguments[1] === "undefined";
|
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_1 && _10_5_7_b_4_2;
|
||||||
};
|
};
|
||||||
return _10_5_7_b_4_fun(30, 12);
|
|
||||||
}
|
assert(_10_5_7_b_4_fun(30, 12), '_10_5_7_b_4_fun(30, 12) !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,15 +7,12 @@ description: >
|
|||||||
arguments[i] remains same after changing actual parameters in
|
arguments[i] remains same after changing actual parameters in
|
||||||
strict mode
|
strict mode
|
||||||
flags: [onlyStrict]
|
flags: [onlyStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function foo(a,b,c)
|
function foo(a,b,c)
|
||||||
{
|
{
|
||||||
a = 1; b = 'str'; c = 2.1;
|
a = 1; b = 'str'; c = 2.1;
|
||||||
return (arguments[0] === 10 && arguments[1] === 'sss' && arguments[2] === 1);
|
return (arguments[0] === 10 && arguments[1] === 'sss' && arguments[2] === 1);
|
||||||
}
|
}
|
||||||
return foo(10, 'sss', 1);
|
|
||||||
}
|
assert(foo(10, 'sss', 1), 'foo(10, "sss", 1) !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -5,16 +5,13 @@
|
|||||||
es5id: 10.6-10-c-ii-1
|
es5id: 10.6-10-c-ii-1
|
||||||
description: arguments[i] change with actual parameters
|
description: arguments[i] change with actual parameters
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function foo(a,b,c)
|
function foo(a,b,c)
|
||||||
{
|
{
|
||||||
a = 1; b = 'str'; c = 2.1;
|
a = 1; b = 'str'; c = 2.1;
|
||||||
if(arguments[0] === 1 && arguments[1] === 'str' && arguments[2] === 2.1)
|
if(arguments[0] === 1 && arguments[1] === 'str' && arguments[2] === 2.1)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return foo(10,'sss',1);
|
|
||||||
}
|
assert(foo(10,'sss',1), 'foo(10,"sss",1) !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -5,16 +5,12 @@
|
|||||||
es5id: 10.6-10-c-ii-2-s
|
es5id: 10.6-10-c-ii-2-s
|
||||||
description: arguments[i] doesn't map to actual parameters in strict mode
|
description: arguments[i] doesn't map to actual parameters in strict mode
|
||||||
flags: [onlyStrict]
|
flags: [onlyStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function foo(a,b,c)
|
function foo(a,b,c)
|
||||||
{
|
{
|
||||||
arguments[0] = 1; arguments[1] = 'str'; arguments[2] = 2.1;
|
arguments[0] = 1; arguments[1] = 'str'; arguments[2] = 2.1;
|
||||||
return 10 === a && 'sss' === b && 1 === c;
|
return 10 === a && 'sss' === b && 1 === c;
|
||||||
}
|
}
|
||||||
return foo(10,'sss',1);
|
|
||||||
}
|
assert(foo(10,'sss',1), 'foo(10,"sss",1) !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -5,17 +5,13 @@
|
|||||||
es5id: 10.6-10-c-ii-2
|
es5id: 10.6-10-c-ii-2
|
||||||
description: arguments[i] map to actual parameter
|
description: arguments[i] map to actual parameter
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function foo(a,b,c)
|
function foo(a,b,c)
|
||||||
{
|
{
|
||||||
arguments[0] = 1; arguments[1] = 'str'; arguments[2] = 2.1;
|
arguments[0] = 1; arguments[1] = 'str'; arguments[2] = 2.1;
|
||||||
if(1 === a && 'str' === b && 2.1 === c)
|
if(1 === a && 'str' === b && 2.1 === c)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return foo(10,'sss',1);
|
|
||||||
}
|
assert(foo(10,'sss',1), 'foo(10,"sss",1) !== true');
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -5,10 +5,8 @@
|
|||||||
es5id: 10.6-13-a-2
|
es5id: 10.6-13-a-2
|
||||||
description: A direct call to arguments.callee.caller should work
|
description: A direct call to arguments.callee.caller should work
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var called = false;
|
var called = false;
|
||||||
|
|
||||||
function test1(flag) {
|
function test1(flag) {
|
||||||
@ -28,7 +26,5 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test1();
|
test1();
|
||||||
return called;
|
|
||||||
}
|
|
||||||
|
|
||||||
runTestCase(testcase);
|
assert(called, 'called !== true');
|
||||||
|
@ -5,10 +5,8 @@
|
|||||||
es5id: 10.6-13-a-3
|
es5id: 10.6-13-a-3
|
||||||
description: An indirect call to arguments.callee.caller should work
|
description: An indirect call to arguments.callee.caller should work
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var called = false;
|
var called = false;
|
||||||
|
|
||||||
function test1(flag) {
|
function test1(flag) {
|
||||||
@ -29,7 +27,5 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test1();
|
test1();
|
||||||
return called;
|
|
||||||
}
|
|
||||||
|
|
||||||
runTestCase(testcase);
|
assert(called, 'called !== true');
|
||||||
|
@ -5,13 +5,11 @@
|
|||||||
es5id: 10.6-14-1-s
|
es5id: 10.6-14-1-s
|
||||||
description: Strict Mode - 'callee' exists and 'caller' exists under strict mode
|
description: Strict Mode - 'callee' exists and 'caller' exists under strict mode
|
||||||
flags: [onlyStrict]
|
flags: [onlyStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var argObj = function () {
|
var argObj = function () {
|
||||||
return arguments;
|
return arguments;
|
||||||
} ();
|
} ();
|
||||||
return argObj.hasOwnProperty("callee") && argObj.hasOwnProperty("caller");
|
|
||||||
}
|
assert(argObj.hasOwnProperty("callee"), 'argObj.hasOwnProperty("callee") !== true');
|
||||||
runTestCase(testcase);
|
assert(argObj.hasOwnProperty("caller"), 'argObj.hasOwnProperty("caller") !== true');
|
||||||
|
@ -7,10 +7,8 @@ description: >
|
|||||||
Strict Mode - [[Enumerable]] attribute value in 'caller' is false
|
Strict Mode - [[Enumerable]] attribute value in 'caller' is false
|
||||||
under strict mode
|
under strict mode
|
||||||
flags: [onlyStrict]
|
flags: [onlyStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var argObj = function () {
|
var argObj = function () {
|
||||||
return arguments;
|
return arguments;
|
||||||
} ();
|
} ();
|
||||||
@ -21,6 +19,6 @@ function testcase() {
|
|||||||
verifyEnumerable = true;
|
verifyEnumerable = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !verifyEnumerable && argObj.hasOwnProperty("caller");
|
|
||||||
}
|
assert.sameValue(verifyEnumerable, false, 'verifyEnumerable');
|
||||||
runTestCase(testcase);
|
assert(argObj.hasOwnProperty("caller"), 'argObj.hasOwnProperty("caller") !== true');
|
||||||
|
@ -5,10 +5,8 @@
|
|||||||
es5id: 10.6-14-c-1-s
|
es5id: 10.6-14-c-1-s
|
||||||
description: >
|
description: >
|
||||||
[[Enumerable]] attribute value in 'callee' is false
|
[[Enumerable]] attribute value in 'callee' is false
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var argObj = function () {
|
var argObj = function () {
|
||||||
return arguments;
|
return arguments;
|
||||||
} ();
|
} ();
|
||||||
@ -19,6 +17,6 @@ function testcase() {
|
|||||||
verifyEnumerable = true;
|
verifyEnumerable = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !verifyEnumerable && argObj.hasOwnProperty("callee");
|
|
||||||
}
|
assert.sameValue(verifyEnumerable, false, 'verifyEnumerable');
|
||||||
runTestCase(testcase);
|
assert(argObj.hasOwnProperty("callee"), 'argObj.hasOwnProperty("callee") !== true');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user