mirror of
https://github.com/tc39/test262.git
synced 2025-07-28 08:24:23 +02:00
Merge "length" tests & refactor using propertyHelper.js harness
This commit is contained in:
parent
f2bc400f98
commit
8a3fe5318d
@ -1,29 +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 Object.prototype.hasOwnProperty.length property has the attribute
|
|
||||||
ReadOnly
|
|
||||||
es5id: 15.2.4.5_A10
|
|
||||||
description: >
|
|
||||||
Checking if varying the Object.prototype.hasOwnProperty.length
|
|
||||||
property fails
|
|
||||||
includes: [propertyHelper.js]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//CHECK#1
|
|
||||||
if (!(Object.prototype.hasOwnProperty.hasOwnProperty('length'))) {
|
|
||||||
$ERROR('#1: the Object.prototype.hasOwnProperty has length property.');
|
|
||||||
}
|
|
||||||
|
|
||||||
var obj = Object.prototype.hasOwnProperty.length;
|
|
||||||
|
|
||||||
verifyNotWritable(Object.prototype.hasOwnProperty, "length", null, function() {
|
|
||||||
return "shifted";
|
|
||||||
});
|
|
||||||
|
|
||||||
//CHECK#2
|
|
||||||
if (Object.prototype.hasOwnProperty.length !== obj) {
|
|
||||||
$ERROR('#2: the Object.prototype.hasOwnProperty length property has the attributes ReadOnly.');
|
|
||||||
}
|
|
@ -1,18 +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 hasOwnProperty method is 1
|
|
||||||
es5id: 15.2.4.5_A11
|
|
||||||
description: Checking the Object.prototype.hasOwnProperty.length
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//CHECK#1
|
|
||||||
if (!(Object.prototype.hasOwnProperty.hasOwnProperty("length"))) {
|
|
||||||
$ERROR('#1: The length property of the toObject method is 1');
|
|
||||||
}
|
|
||||||
|
|
||||||
//CHECK#2
|
|
||||||
if (Object.prototype.hasOwnProperty.length !== 1) {
|
|
||||||
$ERROR('#2: The length property of the toObject method is 1');
|
|
||||||
}
|
|
@ -1,30 +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 Object.prototype.hasOwnProperty.length property has the attribute
|
|
||||||
DontEnum
|
|
||||||
es5id: 15.2.4.5_A8
|
|
||||||
description: >
|
|
||||||
Checking if enumerating the Object.prototype.hasOwnProperty.length
|
|
||||||
property fails
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//CHECK#0
|
|
||||||
if (!(Object.prototype.hasOwnProperty.hasOwnProperty('length'))) {
|
|
||||||
$ERROR('#0: the Object.prototype.hasOwnProperty has length property.');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// CHECK#1
|
|
||||||
if (Object.prototype.hasOwnProperty.propertyIsEnumerable('length')) {
|
|
||||||
$ERROR('#1: the Object.prototype.hasOwnProperty.length property has the attributes DontEnum');
|
|
||||||
}
|
|
||||||
|
|
||||||
// CHECK#2
|
|
||||||
for (var p in Object.prototype.hasOwnProperty) {
|
|
||||||
if (p === "length")
|
|
||||||
$ERROR('#2: the Object.prototype.hasOwnProperty.length property has the attributes DontEnum');
|
|
||||||
}
|
|
||||||
//
|
|
@ -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 Object.prototype.hasOwnProperty.length property does not have the
|
|
||||||
attribute DontDelete
|
|
||||||
es5id: 15.2.4.5_A9
|
|
||||||
description: >
|
|
||||||
Checking if deleting the Object.prototype.hasOwnProperty.length
|
|
||||||
property fails
|
|
||||||
---*/
|
|
||||||
|
|
||||||
//CHECK#0
|
|
||||||
if (!(Object.prototype.hasOwnProperty.hasOwnProperty('length'))) {
|
|
||||||
$ERROR('#0: the Object.prototype.hasOwnProperty has length property');
|
|
||||||
}
|
|
||||||
|
|
||||||
//CHECK#1
|
|
||||||
if (!delete Object.prototype.hasOwnProperty.length) {
|
|
||||||
$ERROR('#1: The Object.prototype.hasOwnProperty.length property does not have the attributes DontDelete');
|
|
||||||
}
|
|
||||||
|
|
||||||
//CHECK#2
|
|
||||||
if (Object.prototype.hasOwnProperty.hasOwnProperty('length')) {
|
|
||||||
$ERROR('#2: The Object.prototype.hasOwnProperty.length property does not have the attributes DontDelete');
|
|
||||||
}
|
|
28
test/built-ins/Object/prototype/hasOwnProperty/length.js
vendored
Normal file
28
test/built-ins/Object/prototype/hasOwnProperty/length.js
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// Copyright (C) 2009 the Sputnik authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-object.prototype.hasownproperty
|
||||||
|
description: >
|
||||||
|
Object.prototype.hasOwnProperty.length is 1.
|
||||||
|
info: |
|
||||||
|
Object.prototype.hasOwnProperty ( V )
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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(Object.prototype.hasOwnProperty, "length", {
|
||||||
|
value: 1,
|
||||||
|
writable: false,
|
||||||
|
enumerable: false,
|
||||||
|
configurable: true,
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user