mirror of https://github.com/tc39/test262.git
Replace runTestCase with assert helpers [test/language/arguments-object]
This commit is contained in:
parent
39b5b7272c
commit
27b234f708
|
@ -5,16 +5,9 @@
|
|||
es5id: 10.6-12-1
|
||||
description: Accessing callee property of Arguments object is allowed
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try
|
||||
{
|
||||
arguments.callee;
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
testcase();
|
||||
|
|
|
@ -5,17 +5,15 @@
|
|||
es5id: 10.6-12-2
|
||||
description: arguments.callee has correct attributes
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(arguments,"callee");
|
||||
if(desc.configurable === true &&
|
||||
desc.enumerable === false &&
|
||||
desc.writable === true &&
|
||||
desc.hasOwnProperty('get') == false &&
|
||||
desc.hasOwnProperty('put') == false)
|
||||
return true;
|
||||
|
||||
assert.sameValue(desc.configurable, true, 'desc.configurable');
|
||||
assert.sameValue(desc.enumerable, false, 'desc.enumerable');
|
||||
assert.sameValue(desc.writable, true, 'desc.writable');
|
||||
assert.sameValue(desc.hasOwnProperty('get'), false, 'desc.hasOwnProperty("get")');
|
||||
assert.sameValue(desc.hasOwnProperty('set'), false, 'desc.hasOwnProperty("set")');
|
||||
}
|
||||
runTestCase(testcase);
|
||||
testcase();
|
||||
|
|
|
@ -5,16 +5,9 @@
|
|||
es5id: 10.6-13-1
|
||||
description: Accessing caller property of Arguments object is allowed
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
try
|
||||
{
|
||||
arguments.caller;
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
testcase();
|
||||
|
|
|
@ -5,11 +5,10 @@
|
|||
es5id: 10.6-13-b-2-s
|
||||
description: arguments.caller exists in strict mode
|
||||
flags: [onlyStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var desc = Object.getOwnPropertyDescriptor(arguments,"caller");
|
||||
return desc!== undefined;
|
||||
assert.notSameValue(desc, undefined);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
testcase();
|
||||
|
|
|
@ -5,18 +5,16 @@
|
|||
es5id: 10.6-13-b-3-s
|
||||
description: arguments.caller is non-configurable in strict mode
|
||||
flags: [onlyStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var desc = Object.getOwnPropertyDescriptor(arguments,"caller");
|
||||
|
||||
return (desc.configurable === false &&
|
||||
desc.enumerable === false &&
|
||||
desc.hasOwnProperty('value') == false &&
|
||||
desc.hasOwnProperty('writable') == false &&
|
||||
desc.hasOwnProperty('get') == true &&
|
||||
desc.hasOwnProperty('set') == true);
|
||||
|
||||
|
||||
assert.sameValue(desc.configurable, false, 'desc.configurable');
|
||||
assert.sameValue(desc.enumerable, false, 'desc.enumerable');
|
||||
assert.sameValue(desc.hasOwnProperty('value'), false, 'desc.hasOwnProperty("value")');
|
||||
assert.sameValue(desc.hasOwnProperty('writable'), false, 'desc.hasOwnProperty("writable")');
|
||||
assert.sameValue(desc.hasOwnProperty('get'), true, 'desc.hasOwnProperty("get")');
|
||||
assert.sameValue(desc.hasOwnProperty('set'), true, 'desc.hasOwnProperty("set")');
|
||||
}
|
||||
runTestCase(testcase);
|
||||
testcase();
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
/*---
|
||||
es5id: 10.6-13-c-2-s
|
||||
description: arguments.callee is exists
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var desc = Object.getOwnPropertyDescriptor(arguments,"callee");
|
||||
return desc !== undefined;
|
||||
assert.notSameValue(desc, undefined);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
testcase();
|
||||
|
|
|
@ -5,16 +5,16 @@
|
|||
es5id: 10.6-13-c-3-s
|
||||
description: arguments.callee is non-configurable in strict mode
|
||||
flags: [onlyStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var desc = Object.getOwnPropertyDescriptor(arguments,"callee");
|
||||
return (desc.configurable === false &&
|
||||
desc.enumerable === false &&
|
||||
desc.hasOwnProperty('value') == false &&
|
||||
desc.hasOwnProperty('writable') == false &&
|
||||
desc.hasOwnProperty('get') == true &&
|
||||
desc.hasOwnProperty('set') == true);
|
||||
|
||||
assert.sameValue(desc.configurable, false, 'desc.configurable');
|
||||
assert.sameValue(desc.enumerable, false, 'desc.enumerable');
|
||||
assert.sameValue(desc.hasOwnProperty('value'), false, 'desc.hasOwnProperty("value")');
|
||||
assert.sameValue(desc.hasOwnProperty('writable'), false, 'desc.hasOwnProperty("writable")');
|
||||
assert.sameValue(desc.hasOwnProperty('get'), true, 'desc.hasOwnProperty("get")');
|
||||
assert.sameValue(desc.hasOwnProperty('set'), true, 'desc.hasOwnProperty("set")');
|
||||
}
|
||||
runTestCase(testcase);
|
||||
testcase();
|
||||
|
|
|
@ -6,11 +6,9 @@ es5id: 10.6-5-1
|
|||
description: >
|
||||
[[Prototype]] property of Arguments is set to Object prototype
|
||||
object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
if(Object.getPrototypeOf(arguments) === Object.getPrototypeOf({}))
|
||||
return true;
|
||||
assert.sameValue(Object.getPrototypeOf(arguments), Object.getPrototypeOf({}));
|
||||
}
|
||||
runTestCase(testcase);
|
||||
testcase();
|
||||
|
|
|
@ -4,12 +4,11 @@
|
|||
/*---
|
||||
es5id: 10.6-6-1
|
||||
description: "'length property of arguments object exists"
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(arguments,"length");
|
||||
return desc !== undefined
|
||||
assert.notSameValue(desc, undefined);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
testcase();
|
||||
|
|
|
@ -4,15 +4,13 @@
|
|||
/*---
|
||||
es5id: 10.6-6-2
|
||||
description: "'length' property of arguments object has correct attributes"
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(arguments,"length");
|
||||
if(desc.configurable === true &&
|
||||
desc.enumerable === false &&
|
||||
desc.writable === true )
|
||||
return true;
|
||||
|
||||
assert.sameValue(desc.configurable, true, 'desc.configurable');
|
||||
assert.sameValue(desc.enumerable, false, 'desc.enumerable');
|
||||
assert.sameValue(desc.writable, true, 'desc.writable');
|
||||
}
|
||||
runTestCase(testcase);
|
||||
testcase();
|
||||
|
|
|
@ -6,10 +6,9 @@ es5id: 10.6-6-3
|
|||
description: >
|
||||
'length' property of arguments object for 0 argument function
|
||||
exists
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
return (function () {return arguments.length !== undefined})();
|
||||
assert.sameValue(arguments.length, 0);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
testcase();
|
||||
|
|
|
@ -7,11 +7,10 @@ description: >
|
|||
'length' property of arguments object for 0 argument function
|
||||
exists
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var arguments= undefined;
|
||||
return (function () {return arguments.length !== undefined})();
|
||||
(function () { assert.sameValue(arguments.length, 0); })();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
testcase();
|
||||
|
|
|
@ -6,10 +6,9 @@ es5id: 10.6-6-4
|
|||
description: >
|
||||
'length' property of arguments object for 0 argument function call
|
||||
is 0 even with formal parameters
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
return (function (a,b,c) {return arguments.length === 0})();
|
||||
function testcase(a,b,c) {
|
||||
assert.sameValue(arguments.length, 0);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
testcase();
|
||||
|
|
|
@ -7,11 +7,10 @@ description: >
|
|||
'length' property of arguments object for 0 argument function call
|
||||
is 0 even with formal parameters
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var arguments= undefined;
|
||||
return (function (a,b,c) {return arguments.length === 0})();
|
||||
(function (a,b,c) { assert.sameValue(arguments.length, 0); })();
|
||||
}
|
||||
runTestCase(testcase);
|
||||
testcase();
|
||||
|
|
Loading…
Reference in New Issue