mirror of https://github.com/tc39/test262.git
Unify "length" tests
This commit is contained in:
parent
6943b289fc
commit
9c93e05d90
|
@ -1,27 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: The Function.prototype.apply.length property has the attribute ReadOnly
|
||||
es5id: 15.3.4.3_A10
|
||||
description: >
|
||||
Checking if varying the Function.prototype.apply.length property
|
||||
fails
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (!(Function.prototype.apply.hasOwnProperty('length'))) {
|
||||
$ERROR('#1: the Function.prototype.apply has length property.');
|
||||
}
|
||||
|
||||
var obj = Function.prototype.apply.length;
|
||||
|
||||
verifyNotWritable(Function.prototype.apply, "length", null, function() {
|
||||
return "shifted";
|
||||
});
|
||||
|
||||
//CHECK#2
|
||||
if (Function.prototype.apply.length !== obj) {
|
||||
$ERROR('#2: the Function.prototype.apply length property has the attributes ReadOnly.');
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: The Function.prototype.apply.length property has the attribute DontEnum
|
||||
es5id: 15.3.4.3_A11
|
||||
description: >
|
||||
TChecking if enumerating the Function.prototype.apply.length
|
||||
property fails
|
||||
---*/
|
||||
|
||||
//CHECK#0
|
||||
if (!(Function.prototype.apply.hasOwnProperty('length'))) {
|
||||
$ERROR('#0: the Function.prototype.apply has length property.');
|
||||
}
|
||||
|
||||
|
||||
// CHECK#1
|
||||
if (Function.prototype.apply.propertyIsEnumerable('length')) {
|
||||
$ERROR('#1: the Function.prototype.apply.length property has the attributes DontEnum');
|
||||
}
|
||||
|
||||
// CHECK#2
|
||||
for (var p in Function.prototype.apply) {
|
||||
if (p === "length")
|
||||
$ERROR('#2: the Function.prototype.apply.length property has the attributes DontEnum');
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: The length property of the apply method is 2
|
||||
es5id: 15.3.4.3_A2_T1
|
||||
description: Checking Function.prototype.apply.length
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (typeof Function.prototype.apply !== "function") {
|
||||
$ERROR('#1: apply method defined');
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (typeof Function.prototype.apply.length === "undefined") {
|
||||
$ERROR('#2: length property of apply method defined');
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (Function.prototype.apply.length !== 2) {
|
||||
$ERROR('#3: The length property of the apply method is 2');
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: The length property of the apply method is 2
|
||||
es5id: 15.3.4.3_A2_T2
|
||||
description: Checking f.apply.length, where f is new Function
|
||||
---*/
|
||||
|
||||
var f = new Function;
|
||||
|
||||
//CHECK#1
|
||||
if (typeof f.apply !== "function") {
|
||||
$ERROR('#1: apply method accessed');
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (typeof f.apply.length === "undefined") {
|
||||
$ERROR('#2: length property of apply method defined');
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (f.apply.length !== 2) {
|
||||
$ERROR('#3: The length property of the apply method is 2');
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: |
|
||||
The Function.prototype.apply.length property does not have the attribute
|
||||
DontDelete
|
||||
es5id: 15.3.4.3_A9
|
||||
description: >
|
||||
Checking if deleting the Function.prototype.apply.length property
|
||||
fails
|
||||
---*/
|
||||
|
||||
//CHECK#0
|
||||
if (!(Function.prototype.apply.hasOwnProperty('length'))) {
|
||||
$ERROR('#0: the Function.prototype.apply has length property');
|
||||
}
|
||||
|
||||
//CHECK#1
|
||||
if (!delete Function.prototype.apply.length) {
|
||||
$ERROR('#1: The Function.prototype.apply.length property does not have the attributes DontDelete');
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (Function.prototype.apply.hasOwnProperty('length')) {
|
||||
$ERROR('#2: The Function.prototype.apply.length property does not have the attributes DontDelete');
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-function.prototype.apply
|
||||
description: >
|
||||
Function.prototype.apply.length is 2.
|
||||
info: |
|
||||
ECMAScript Standard Built-in Objects
|
||||
...
|
||||
Every built-in Function object, including constructors, has a length
|
||||
property whose value is an integer. Unless otherwise specified, this value
|
||||
is equal to the largest number of named arguments shown in the subclause
|
||||
headings for the function description, including optional parameters.
|
||||
...
|
||||
Unless otherwise specified, the length property of a built-in Function
|
||||
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
||||
[[Configurable]]: true }.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
verifyProperty(Function.prototype.apply, 'length', {
|
||||
value: 2,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: true,
|
||||
});
|
Loading…
Reference in New Issue