Skip to content
Snippets Groups Projects
Commit 6fc8082e authored by Rick Waldron's avatar Rick Waldron Committed by GitHub
Browse files

Merge pull request #963 from leobalter/prop-descs

Cleanup prop desc tests in the Array folder
parents f77a406e 7972f9bb
No related branches found
No related tags found
No related merge requests found
Showing
with 77 additions and 79 deletions
// 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;');
}
// 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');
}
// 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));
}
// 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));
}
// 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-array
description: >
The Array constructor is a built-in function
---*/
assert.sameValue(typeof Array, 'function');
// 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');
// 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: >
The "name" property of Array
info: |
17 ECMAScript Standard Built-in Objects
Every built-in Function object, including constructors, that is not
identified as an anonymous function has a name property whose value is a
String. Unless otherwise specified, this value is the name that is given to
the function in this specification.
[...]
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/
assert.sameValue(Array.name, 'Array');
verifyNotEnumerable(Array, 'name');
verifyNotWritable(Array, 'name');
verifyConfigurable(Array, 'name');
// Copyright (C) 2017 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-properties-of-the-array-constructor
description: >
The prototype of the Array constructor is the intrinsic object %FunctionPrototype%.
info: |
22.1.2 Properties of the Array Constructor
The value of the [[Prototype]] internal slot of the Array constructor is the
intrinsic object %FunctionPrototype%.
---*/
assert.sameValue(Object.getPrototypeOf(Array), Function.prototype);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment