Merge "length" tests & refactor using propertyHelper.js harness

This commit is contained in:
Alexey Shvayka 2020-05-04 05:02:16 +03:00 committed by Rick Waldron
parent f2bc400f98
commit 8a3fe5318d
5 changed files with 28 additions and 104 deletions

View File

@ -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.');
}

View File

@ -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');
}

View File

@ -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');
}
//

View File

@ -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');
}

View 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,
});