Update tests for Array.length

This commit is contained in:
Leo Balter 2017-04-11 00:37:39 -04:00
parent e98ccd13ef
commit 0546fb2f52
No known key found for this signature in database
GPG Key ID: 2C75F319D398E36B
5 changed files with 24 additions and 79 deletions

View File

@ -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 Array has the attribute DontEnum
es5id: 15.4.3_A2.1
description: Checking use propertyIsEnumerable, for-in
---*/
//CHECK#1
if (Array.propertyIsEnumerable('length') !== false) {
$ERROR('#1: Array.propertyIsEnumerable(\'length\') === false. Actual: ' + (Array.propertyIsEnumerable('length')));
}
//CHECK#2
var result = true;
for (var p in Array){
if (p === "length") {
result = false;
}
}
if (result !== true) {
$ERROR('#2: result = true; for (p in Array.slice) { if (p === "length") result = false; } result === true;');
}

View File

@ -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 Array does not have the attribute DontDelete
es5id: 15.4.3_A2.2
description: Checking use hasOwnProperty, delete
---*/
//CHECK#1
if (Array.hasOwnProperty('length') !== true) {
$ERROR('#1: Array.hasOwnProperty(\'length\') === true. Actual: ' + (Array.hasOwnProperty('length')));
}
delete Array.length;
//CHECK#2
if (Array.hasOwnProperty('length') !== false) {
$ERROR('#2: delete Array.length; Array.hasOwnProperty(\'length\') === false. Actual: ' + (Array.hasOwnProperty('length')));
}
//CHECK#3
if (Array.length === undefined) {
$ERROR('#3: delete Array.length; Array.length !== undefined');
}

View File

@ -1,16 +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 Array has the attribute ReadOnly
es5id: 15.4.3_A2.3
description: Checking if varying the length property fails
includes: [propertyHelper.js]
---*/
//CHECK#1
var x = Array.length;
verifyNotWritable(Array, "length", null, Infinity);
if (Array.length !== x) {
$ERROR('#1: x = Array.length; Array.length = Infinity; Array.length === x. Actual: ' + (Array.length));
}

View File

@ -1,13 +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 Array is 1
es5id: 15.4.3_A2.4
description: Array.length === 1
---*/
//CHECK#1
if (Array.length !== 1) {
$ERROR('#1: Array.length === 1. Actual: ' + (Array.length));
}

View File

@ -0,0 +1,24 @@
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array-constructor
description: >
Array has a "length" property whose value is 1.
info: |
22.1.1 The Array Constructor
The length property of the Array constructor function is 1.
...
ES7 section 17: Unless otherwise specified, the length property of a built-in
Function object has the attributes { [[Writable]]: false, [[Enumerable]]:
false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
assert.sameValue(Array.length, 1);
verifyNotEnumerable(Array, 'length');
verifyNotWritable(Array, 'length');
verifyConfigurable(Array, 'length');