mirror of
https://github.com/tc39/test262.git
synced 2025-06-22 06:50:32 +02:00
Merge pull request #963 from leobalter/prop-descs
Cleanup prop desc tests in the Array folder
This commit is contained in:
commit
6fc8082e64
@ -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;');
|
||||
}
|
@ -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');
|
||||
}
|
@ -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));
|
||||
}
|
@ -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));
|
||||
}
|
10
test/built-ins/Array/constructor.js
Normal file
10
test/built-ins/Array/constructor.js
Normal file
@ -0,0 +1,10 @@
|
||||
// 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');
|
24
test/built-ins/Array/length.js
Normal file
24
test/built-ins/Array/length.js
Normal 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');
|
28
test/built-ins/Array/name.js
Normal file
28
test/built-ins/Array/name.js
Normal file
@ -0,0 +1,28 @@
|
||||
// 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');
|
15
test/built-ins/Array/proto.js
Normal file
15
test/built-ins/Array/proto.js
Normal file
@ -0,0 +1,15 @@
|
||||
// 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);
|
13
test/built-ins/Array/prototype/S15.4.3.1_A1.js
vendored
13
test/built-ins/Array/prototype/S15.4.3.1_A1.js
vendored
@ -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 Array has property prototype
|
||||
es5id: 15.4.3.1_A1
|
||||
description: Checking use hasOwnProperty
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.hasOwnProperty('prototype') !== true) {
|
||||
$ERROR('#1: Array.hasOwnProperty(\'prototype\') === true. Actual: ' + (Array.hasOwnProperty('prototype')));
|
||||
}
|
25
test/built-ins/Array/prototype/S15.4.3.1_A2.js
vendored
25
test/built-ins/Array/prototype/S15.4.3.1_A2.js
vendored
@ -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 Array.prototype property has the attribute DontEnum
|
||||
es5id: 15.4.3.1_A2
|
||||
description: Checking if enumerating the Array.prototype property fails
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.propertyIsEnumerable('prototype') !== false) {
|
||||
$ERROR('#1: Array.propertyIsEnumerable(\'prototype\') === false. Actual: ' + (Array.propertyIsEnumerable('prototype')));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
var result = true;
|
||||
for (var p in Array){
|
||||
if (p === "prototype") {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (result !== true) {
|
||||
$ERROR('#2: result = true; for (p in Array) { if (p === "prototype") result = false; } result === true;');
|
||||
}
|
36
test/built-ins/Array/prototype/S15.4.3.1_A3.js
vendored
36
test/built-ins/Array/prototype/S15.4.3.1_A3.js
vendored
@ -1,36 +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 Array.prototype property has the attribute DontDelete
|
||||
es5id: 15.4.3.1_A3
|
||||
description: Checking if deleting the Array.prototype property fails
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.hasOwnProperty('prototype') !== true) {
|
||||
$ERROR('#1: Array.hasOwnProperty(\'prototype\') === true. Actual: ' + (Array.hasOwnProperty('prototype')));
|
||||
}
|
||||
|
||||
verifyNotConfigurable(Array, "prototype");
|
||||
|
||||
//CHECK#2
|
||||
try {
|
||||
if((delete Array.prototype) !== false){
|
||||
$ERROR('#2: Array.prototype has the attribute DontDelete');
|
||||
}
|
||||
} catch (e) {
|
||||
if (e instanceof Test262Error) throw e;
|
||||
assert(e instanceof TypeError);
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (Array.hasOwnProperty('prototype') !== true) {
|
||||
$ERROR('#3: delete Array.prototype; Array.hasOwnProperty(\'prototype\') === true. Actual: ' + (Array.hasOwnProperty('prototype')));
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (Array.prototype === undefined) {
|
||||
$ERROR('#4: delete Array.prototype; Array.prototype !== undefined');
|
||||
}
|
16
test/built-ins/Array/prototype/S15.4.3.1_A4.js
vendored
16
test/built-ins/Array/prototype/S15.4.3.1_A4.js
vendored
@ -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 Array.prototype property has the attribute ReadOnly
|
||||
es5id: 15.4.3.1_A4
|
||||
description: Checking if varying the Array.prototype property fails
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = Array.prototype;
|
||||
verifyNotWritable(Array, "prototype", null, 1);
|
||||
if (Array.prototype !== x) {
|
||||
$ERROR('#1: x = Array.prototype; Array.prototype = 1; Array.prototype === x. Actual: ' + (Array.prototype));
|
||||
}
|
13
test/built-ins/Array/prototype/S15.4.3.1_A5.js
vendored
13
test/built-ins/Array/prototype/S15.4.3.1_A5.js
vendored
@ -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.prototype is 0
|
||||
es5id: 15.4.3.1_A5
|
||||
description: Array.prototype.length === 0
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.length !== 0) {
|
||||
$ERROR('#1.1: Array.prototype.length === 0. Actual: ' + (Array.prototype.length));
|
||||
}
|
@ -1,24 +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 value of the internal [[Prototype]] property of
|
||||
the Array prototype object is the Object prototype object
|
||||
es5id: 15.4.4_A1.1_T1
|
||||
description: >
|
||||
Create new property of Function.prototype. When Array.prototype
|
||||
object has this property
|
||||
---*/
|
||||
|
||||
Object.prototype.myproperty = 1;
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.myproperty !== 1) {
|
||||
$ERROR('#1: Object.prototype.myproperty = 1; Array.prototype.myproperty === 1. Actual: ' + (Array.prototype.myproperty));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (Array.prototype.hasOwnProperty('myproperty') !== false) {
|
||||
$ERROR('#2: Object.prototype.myproperty = 1; Array.prototype.hasOwnProperty(\'myproperty\') === false. Actual: ' + (Array.prototype.hasOwnProperty('myproperty')));
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 15.4.4_A1.1_T2
|
||||
description: >
|
||||
The Array prototype object is itself an array; its [[Class]]
|
||||
is "Array",
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Object.prototype.toString.call(Array.prototype) !== "[object Array]") {
|
||||
$ERROR('The Array prototype object is itself an array; its' +
|
||||
'[[Class]] is "Array".');
|
||||
}
|
@ -1,15 +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 value of the internal [[Prototype]] property of
|
||||
the Array prototype object is the Object prototype object
|
||||
es5id: 15.4.4_A1.1_T3
|
||||
description: Checking use isPrototypeOf
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Object.prototype.isPrototypeOf(Array.prototype) !== true) {
|
||||
$ERROR('#1: Object.prototype.isPrototypeOf(Array.prototype) === true. Actual: ' + (Object.prototype.isPrototypeOf(Array.prototype)));
|
||||
}
|
@ -1,14 +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 [[Class]] property of the Array prototype object is set to "Array"
|
||||
es5id: 15.4.4_A1.2_T1
|
||||
description: Checking use Object.prototype.toString
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
Array.prototype.getClass = Object.prototype.toString;
|
||||
if (Array.prototype.getClass() !== "[object " + "Array" + "]") {
|
||||
$ERROR('#1: Array.prototype.getClass = Object.prototype.toString; Array.prototype is Array object. Actual: ' + (Array.prototype.getClass()));
|
||||
}
|
@ -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 Array prototype object does not have a valueOf property of
|
||||
its own; however, it inherits the valueOf property from the valueOf
|
||||
property from the Object prototype Object
|
||||
es5id: 15.4.4_A2.1_T1
|
||||
description: Checking use hasOwnProperty
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.hasOwnProperty('valueOf') !== false) {
|
||||
$ERROR('#1: Array.prototype.hasOwnProperty(\'valueOf\') === false. Actual: ' + (Array.prototype.hasOwnProperty('valueOf')));
|
||||
}
|
@ -1,26 +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 Array prototype object does not have a valueOf property of
|
||||
its own; however, it inherits the valueOf property from the valueOf
|
||||
property from the Object prototype Object
|
||||
es5id: 15.4.4_A2.1_T2
|
||||
description: >
|
||||
Change valueOf property of Object.prototype. When
|
||||
Array.prototype.valueOf also change
|
||||
---*/
|
||||
|
||||
Object.prototype.valueOf = 1;
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.valueOf !== 1) {
|
||||
$ERROR('#1: Object.prototype.valueOf = 1; Array.prototype.valueOf === 1. Actual: ' + (Array.prototype.valueOf));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
var x = new Array();
|
||||
if (x.valueOf !== 1) {
|
||||
$ERROR('#1: Object.prototype.valueOf = 1; x = new Array(); x.valueOf === 1. Actual: ' + (x.valueOf));
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
// Copyright (c) 2014 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es6id: 22.1.3.1_3
|
||||
description: Array.prototype.concat arity
|
||||
---*/
|
||||
assert.sameValue(Array.prototype.concat.length, 1);
|
@ -1,11 +0,0 @@
|
||||
// Copyright (c) 2014 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
||||
/*---
|
||||
es6id: 22.1.3.1_3
|
||||
description: Array.prototype.concat descriptor
|
||||
---*/
|
||||
var desc = Object.getOwnPropertyDescriptor(Array.prototype, "concat");
|
||||
assert.sameValue(desc.enumerable, false);
|
@ -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 concat has the attribute DontEnum
|
||||
es5id: 15.4.4.4_A4.1
|
||||
description: Checking use propertyIsEnumerable, for-in
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.concat.propertyIsEnumerable('length') !== false) {
|
||||
$ERROR('#1: Array.prototype.concat.propertyIsEnumerable(\'length\') === false. Actual: ' + (Array.prototype.concat.propertyIsEnumerable('length')));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
var result = true;
|
||||
for (var p in Array.prototype.concat){
|
||||
if (p === "length") {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (result !== true) {
|
||||
$ERROR('#2: result = true; for (p in Array.prototype.concat) { if (p === "length") result = false; } result === true;');
|
||||
}
|
@ -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 concat does not have the attribute DontDelete
|
||||
es5id: 15.4.4.4_A4.2
|
||||
description: Checking use hasOwnProperty, delete
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.concat.hasOwnProperty('length') !== true) {
|
||||
$ERROR('#1: Array.prototype.concat.hasOwnProperty(\'length\') === true. Actual: ' + (Array.prototype.concat.hasOwnProperty('length')));
|
||||
}
|
||||
|
||||
delete Array.prototype.concat.length;
|
||||
|
||||
//CHECK#2
|
||||
if (Array.prototype.concat.hasOwnProperty('length') !== false) {
|
||||
$ERROR('#2: delete Array.prototype.concat.length; Array.prototype.concat.hasOwnProperty(\'length\') === false. Actual: ' + (Array.prototype.concat.hasOwnProperty('length')));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (Array.prototype.concat.length === undefined) {
|
||||
$ERROR('#3: delete Array.prototype.concat.length; Array.prototype.concat.length !== undefined');
|
||||
}
|
@ -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 concat has the attribute ReadOnly
|
||||
es5id: 15.4.4.4_A4.3
|
||||
description: Checking if varying the length property fails
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = Array.prototype.concat.length;
|
||||
verifyNotWritable(Array.prototype.concat, "length", null, Infinity);
|
||||
if (Array.prototype.concat.length !== x) {
|
||||
$ERROR('#1: x = Array.prototype.concat.length; Array.prototype.concat.length = Infinity; Array.prototype.concat.length === x. Actual: ' + (Array.prototype.concat.length));
|
||||
}
|
@ -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 concat is 1
|
||||
es5id: 15.4.4.4_A4.4
|
||||
description: concat.length === 1
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.concat.length !== 1) {
|
||||
$ERROR('#1: Array.prototype.concat.length === 1. Actual: ' + (Array.prototype.concat.length));
|
||||
}
|
@ -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 concat property of Array has the attribute DontEnum
|
||||
es5id: 15.4.4.4_A4.5
|
||||
description: Checking use propertyIsEnumerable, for-in
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.propertyIsEnumerable('concat') !== false) {
|
||||
$ERROR('#1: Array.propertyIsEnumerable(\'concat\') === false. Actual: ' + (Array.propertyIsEnumerable('concat')));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
var result = true;
|
||||
for (var p in Array){
|
||||
if (p === "concat") {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (result !== true) {
|
||||
$ERROR('#2: result = true; for (p in Array) { if (p === "concat") result = false; } result === true;');
|
||||
}
|
@ -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 concat property of Array has not prototype property
|
||||
es5id: 15.4.4.4_A4.6
|
||||
description: Checking Array.prototype.concat.prototype
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.concat.prototype !== undefined) {
|
||||
$ERROR('#1: Array.prototype.concat.prototype === undefined. Actual: ' + (Array.prototype.concat.prototype));
|
||||
}
|
@ -1,21 +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 concat property of Array can't be used as constructor
|
||||
es5id: 15.4.4.4_A4.7
|
||||
description: >
|
||||
If property does not implement the internal [[Construct]] method,
|
||||
throw a TypeError exception
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
|
||||
try {
|
||||
new Array.prototype.concat();
|
||||
$ERROR('#1.1: new Array.prototype.concat() throw TypeError. Actual: ' + (new Array.prototype.concat()));
|
||||
} catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
$ERROR('#1.2: new Array.prototype.concat() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
32
test/built-ins/Array/prototype/concat/length.js
vendored
Normal file
32
test/built-ins/Array/prototype/concat/length.js
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.concat
|
||||
description: >
|
||||
The "length" property of Array.prototype.concat
|
||||
info: |
|
||||
22.1.3.1 Array.prototype.concat ( ...arguments )
|
||||
|
||||
The length property of the concat method is 1.
|
||||
|
||||
17 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. Optional parameters (which are indicated with brackets:
|
||||
[ ]) or rest parameters (which are shown using the form «...name») are not
|
||||
included in the default argument count.
|
||||
|
||||
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.prototype.concat.length, 1);
|
||||
|
||||
verifyNotEnumerable(Array.prototype.concat, 'length');
|
||||
verifyNotWritable(Array.prototype.concat, 'length');
|
||||
verifyConfigurable(Array.prototype.concat, 'length');
|
22
test/built-ins/Array/prototype/concat/not-a-constructor.js
vendored
Normal file
22
test/built-ins/Array/prototype/concat/not-a-constructor.js
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.concat
|
||||
description: >
|
||||
Array.prototype.concat is not a constructor.
|
||||
info: |
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
Built-in function objects that are not identified as constructors do not
|
||||
implement the [[Construct]] internal method unless otherwise specified in
|
||||
the description of a particular function.
|
||||
---*/
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new Array.prototype.concat();
|
||||
});
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
new [].concat();
|
||||
});
|
21
test/built-ins/Array/prototype/concat/prop-desc.js
vendored
Normal file
21
test/built-ins/Array/prototype/concat/prop-desc.js
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.concat
|
||||
description: >
|
||||
"concat" property of Array.prototype
|
||||
info: |
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
Every other data property described in clauses 18 through 26 and in Annex B.2
|
||||
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
|
||||
[[Configurable]]: true } unless otherwise specified.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(typeof Array.prototype.concat, 'function', 'typeof');
|
||||
|
||||
verifyNotEnumerable(Array.prototype, "concat");
|
||||
verifyWritable(Array.prototype, "concat");
|
||||
verifyConfigurable(Array.prototype, "concat");
|
25
test/built-ins/Array/prototype/constructor.js
vendored
Normal file
25
test/built-ins/Array/prototype/constructor.js
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.constructor
|
||||
description: >
|
||||
Array.prototype.constructor
|
||||
info: |
|
||||
22.1.3.2 Array.prototype.constructor
|
||||
|
||||
The initial value of Array.prototype.constructor is the intrinsic object %Array%.
|
||||
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
Every other data property described in clauses 18 through 26 and in Annex B.2
|
||||
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
|
||||
[[Configurable]]: true } unless otherwise specified.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Array.prototype.constructor, Array);
|
||||
|
||||
verifyNotEnumerable(Array.prototype, 'constructor');
|
||||
verifyWritable(Array.prototype, 'constructor');
|
||||
verifyConfigurable(Array.prototype, 'constructor');
|
@ -1,15 +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 initial value of Array.prototype.constructor is
|
||||
the built-in Array constructor
|
||||
es5id: 15.4.4.1_A1_T1
|
||||
description: Array.prototype.constructor === Array
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.constructor !== Array) {
|
||||
$ERROR('#1: Array.prototype.constructor === Array. Actual: ' + (Array.prototype.constructor));
|
||||
}
|
@ -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 constructor property of Array has the attribute DontEnum
|
||||
es5id: 15.4.4.1_A2
|
||||
description: Checking use propertyIsEnumerable, for-in
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.propertyIsEnumerable('constructor') !== false) {
|
||||
$ERROR('#1: Array.propertyIsEnumerable(\'constructor\') === false. Actual: ' + (Array.propertyIsEnumerable('constructor')));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
var result = true;
|
||||
for (var p in Array){
|
||||
if (p === "constructor") {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (result !== true) {
|
||||
$ERROR('#2: result = true; for (p in Array) { if (p === "constructor") result = false; } result === true;');
|
||||
}
|
21
test/built-ins/Array/prototype/every/prop-desc.js
vendored
Normal file
21
test/built-ins/Array/prototype/every/prop-desc.js
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.every
|
||||
description: >
|
||||
"every" property of Array.prototype
|
||||
info: |
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
Every other data property described in clauses 18 through 26 and in Annex B.2
|
||||
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
|
||||
[[Configurable]]: true } unless otherwise specified.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(typeof Array.prototype.every, 'function', 'typeof');
|
||||
|
||||
verifyNotEnumerable(Array.prototype, "every");
|
||||
verifyWritable(Array.prototype, "every");
|
||||
verifyConfigurable(Array.prototype, "every");
|
24
test/built-ins/Array/prototype/exotic-array.js
vendored
Normal file
24
test/built-ins/Array/prototype/exotic-array.js
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// 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-prototype-object
|
||||
description: >
|
||||
Array.prototype is an exoctic array object
|
||||
info: |
|
||||
22.1.3 Properties of the Array Prototype Object
|
||||
|
||||
(...)
|
||||
The Array prototype object is an Array exotic object and has the internal
|
||||
methods specified for such objects.
|
||||
---*/
|
||||
|
||||
Array.prototype[2] = 42;
|
||||
|
||||
assert.sameValue(Array.prototype.length, 3);
|
||||
assert.sameValue(Array.prototype[0], undefined, 'Array.prototype[0]');
|
||||
assert.sameValue(Array.prototype[1], undefined, 'Array.prototype[1]');
|
||||
assert.sameValue(Array.prototype[2], 42, 'Array.prototype[2]');
|
||||
|
||||
assert.sameValue({}.toString.call(Array.prototype), '[object Array]');
|
@ -1,11 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 15.4.4.20-0-1
|
||||
description: Array.prototype.filter must exist as a function
|
||||
---*/
|
||||
|
||||
var f = Array.prototype.filter;
|
||||
|
||||
assert.sameValue(typeof(f), "function", 'typeof(f)');
|
@ -1,9 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 15.4.4.20-0-2
|
||||
description: Array.prototype.filter.length must be 1
|
||||
---*/
|
||||
|
||||
assert.sameValue(Array.prototype.filter.length, 1, 'Array.prototype.filter.length');
|
30
test/built-ins/Array/prototype/filter/length.js
vendored
Normal file
30
test/built-ins/Array/prototype/filter/length.js
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.filter
|
||||
description: >
|
||||
The "length" property of Array.prototype.filter
|
||||
info: |
|
||||
22.1.3.7 Array.prototype.filter ( callbackfn [ , thisArg ] )
|
||||
|
||||
17 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. Optional parameters (which are indicated with brackets:
|
||||
[ ]) or rest parameters (which are shown using the form «...name») are not
|
||||
included in the default argument count.
|
||||
|
||||
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.prototype.filter.length, 1);
|
||||
|
||||
verifyNotEnumerable(Array.prototype.filter, 'length');
|
||||
verifyNotWritable(Array.prototype.filter, 'length');
|
||||
verifyConfigurable(Array.prototype.filter, 'length');
|
21
test/built-ins/Array/prototype/filter/prop-desc.js
vendored
Normal file
21
test/built-ins/Array/prototype/filter/prop-desc.js
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.filter
|
||||
description: >
|
||||
"filter" property of Array.prototype
|
||||
info: |
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
Every other data property described in clauses 18 through 26 and in Annex B.2
|
||||
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
|
||||
[[Configurable]]: true } unless otherwise specified.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(typeof Array.prototype.filter, 'function', 'typeof');
|
||||
|
||||
verifyNotEnumerable(Array.prototype, "filter");
|
||||
verifyWritable(Array.prototype, "filter");
|
||||
verifyConfigurable(Array.prototype, "filter");
|
@ -1,11 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 15.4.4.18-0-1
|
||||
description: Array.prototype.forEach must exist as a function
|
||||
---*/
|
||||
|
||||
var f = Array.prototype.forEach;
|
||||
|
||||
assert.sameValue(typeof(f), "function", 'typeof(f)');
|
@ -1,9 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 15.4.4.18-0-2
|
||||
description: Array.prototype.forEach.length must be 1
|
||||
---*/
|
||||
|
||||
assert.sameValue(Array.prototype.forEach.length, 1, 'Array.prototype.forEach.length');
|
30
test/built-ins/Array/prototype/forEach/length.js
vendored
Normal file
30
test/built-ins/Array/prototype/forEach/length.js
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.forEach
|
||||
description: >
|
||||
The "length" property of Array.prototype.forEach
|
||||
info: |
|
||||
22.1.3.10 Array.prototype.forEach ( callbackfn [ , thisArg ] )
|
||||
|
||||
17 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. Optional parameters (which are indicated with brackets:
|
||||
[ ]) or rest parameters (which are shown using the form «...name») are not
|
||||
included in the default argument count.
|
||||
|
||||
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.prototype.forEach.length, 1);
|
||||
|
||||
verifyNotEnumerable(Array.prototype.forEach, 'length');
|
||||
verifyNotWritable(Array.prototype.forEach, 'length');
|
||||
verifyConfigurable(Array.prototype.forEach, 'length');
|
21
test/built-ins/Array/prototype/forEach/prop-desc.js
vendored
Normal file
21
test/built-ins/Array/prototype/forEach/prop-desc.js
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.forEach
|
||||
description: >
|
||||
"forEach" property of Array.prototype
|
||||
info: |
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
Every other data property described in clauses 18 through 26 and in Annex B.2
|
||||
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
|
||||
[[Configurable]]: true } unless otherwise specified.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(typeof Array.prototype.forEach, 'function', 'typeof');
|
||||
|
||||
verifyNotEnumerable(Array.prototype, "forEach");
|
||||
verifyWritable(Array.prototype, "forEach");
|
||||
verifyConfigurable(Array.prototype, "forEach");
|
@ -1,11 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 15.4.4.14-0-1
|
||||
description: Array.prototype.indexOf must exist as a function
|
||||
---*/
|
||||
|
||||
var f = Array.prototype.indexOf;
|
||||
|
||||
assert.sameValue(typeof(f), "function", 'typeof(f)');
|
@ -1,9 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 15.4.4.14-0-2
|
||||
description: Array.prototype.indexOf has a length property whose value is 1.
|
||||
---*/
|
||||
|
||||
assert.sameValue(Array.prototype.indexOf.length, 1, 'Array.prototype.indexOf.length');
|
28
test/built-ins/Array/prototype/indexOf/length.js
vendored
Normal file
28
test/built-ins/Array/prototype/indexOf/length.js
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.indexof
|
||||
description: >
|
||||
The "length" property of Array.prototype.indexOf
|
||||
info: |
|
||||
17 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. Optional parameters (which are indicated with brackets:
|
||||
[ ]) or rest parameters (which are shown using the form «...name») are not
|
||||
included in the default argument count.
|
||||
|
||||
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.prototype.indexOf.length, 1);
|
||||
|
||||
verifyNotEnumerable(Array.prototype.indexOf, 'length');
|
||||
verifyNotWritable(Array.prototype.indexOf, 'length');
|
||||
verifyConfigurable(Array.prototype.indexOf, 'length');
|
21
test/built-ins/Array/prototype/indexOf/prop-desc.js
vendored
Normal file
21
test/built-ins/Array/prototype/indexOf/prop-desc.js
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.indexof
|
||||
description: >
|
||||
"indexOf" property of Array.prototype
|
||||
info: |
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
Every other data property described in clauses 18 through 26 and in Annex B.2
|
||||
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
|
||||
[[Configurable]]: true } unless otherwise specified.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(typeof Array.prototype.indexOf, 'function', 'typeof');
|
||||
|
||||
verifyNotEnumerable(Array.prototype, "indexOf");
|
||||
verifyWritable(Array.prototype, "indexOf");
|
||||
verifyConfigurable(Array.prototype, "indexOf");
|
@ -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 join has the attribute DontEnum
|
||||
es5id: 15.4.4.5_A6.1
|
||||
description: Checking use propertyIsEnumerable, for-in
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.join.propertyIsEnumerable('length') !== false) {
|
||||
$ERROR('#1: Array.prototype.join.propertyIsEnumerable(\'length\') === false. Actual: ' + (Array.prototype.join.propertyIsEnumerable('length')));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
var result = true;
|
||||
for (var p in Array.prototype.join){
|
||||
if (p === "length") {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (result !== true) {
|
||||
$ERROR('#2: result = true; for (p in Array.prototype.join) { if (p === "length") result = false; } result === true;');
|
||||
}
|
@ -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 join does not have the attribute DontDelete
|
||||
es5id: 15.4.4.5_A6.2
|
||||
description: Checking use hasOwnProperty, delete
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.join.hasOwnProperty('length') !== true) {
|
||||
$ERROR('#1: Array.prototype.join.hasOwnProperty(\'length\') === true. Actual: ' + (Array.prototype.join.hasOwnProperty('length')));
|
||||
}
|
||||
|
||||
delete Array.prototype.join.length;
|
||||
|
||||
//CHECK#2
|
||||
if (Array.prototype.join.hasOwnProperty('length') !== false) {
|
||||
$ERROR('#2: delete Array.prototype.join.length; Array.prototype.join.hasOwnProperty(\'length\') === false. Actual: ' + (Array.prototype.join.hasOwnProperty('length')));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (Array.prototype.join.length === undefined) {
|
||||
$ERROR('#3: delete Array.prototype.join.length; Array.prototype.join.length !== undefined');
|
||||
}
|
@ -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 join has the attribute ReadOnly
|
||||
es5id: 15.4.4.5_A6.3
|
||||
description: Checking if varying the length property fails
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = Array.prototype.join.length;
|
||||
verifyNotWritable(Array.prototype.join, "length", null, Infinity);
|
||||
if (Array.prototype.join.length !== x) {
|
||||
$ERROR('#1: x = Array.prototype.join.length; Array.prototype.join.length = Infinity; Array.prototype.join.length === x. Actual: ' + (Array.prototype.join.length));
|
||||
}
|
@ -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 join is 1
|
||||
es5id: 15.4.4.5_A6.4
|
||||
description: join.length === 1
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.join.length !== 1) {
|
||||
$ERROR('#1: Array.prototype.join.length === 1. Actual: ' + (Array.prototype.join.length));
|
||||
}
|
@ -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 join property of Array has the attribute DontEnum
|
||||
es5id: 15.4.4.5_A6.5
|
||||
description: Checking use propertyIsEnumerable, for-in
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.propertyIsEnumerable('join') !== false) {
|
||||
$ERROR('#1: Array.propertyIsEnumerable(\'join\') === false. Actual: ' + (Array.propertyIsEnumerable('join')));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
var result = true;
|
||||
for (var p in Array){
|
||||
if (p === "join") {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (result !== true) {
|
||||
$ERROR('#2: result = true; for (p in Array) { if (p === "join") result = false; } result === true;');
|
||||
}
|
28
test/built-ins/Array/prototype/join/length.js
vendored
Normal file
28
test/built-ins/Array/prototype/join/length.js
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.join
|
||||
description: >
|
||||
The "length" property of Array.prototype.join
|
||||
info: |
|
||||
17 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. Optional parameters (which are indicated with brackets:
|
||||
[ ]) or rest parameters (which are shown using the form «...name») are not
|
||||
included in the default argument count.
|
||||
|
||||
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.prototype.join.length, 1);
|
||||
|
||||
verifyNotEnumerable(Array.prototype.join, 'length');
|
||||
verifyNotWritable(Array.prototype.join, 'length');
|
||||
verifyConfigurable(Array.prototype.join, 'length');
|
21
test/built-ins/Array/prototype/join/prop-desc.js
vendored
Normal file
21
test/built-ins/Array/prototype/join/prop-desc.js
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.join
|
||||
description: >
|
||||
"join" property of Array.prototype
|
||||
info: |
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
Every other data property described in clauses 18 through 26 and in Annex B.2
|
||||
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
|
||||
[[Configurable]]: true } unless otherwise specified.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(typeof Array.prototype.join, 'function', 'typeof');
|
||||
|
||||
verifyNotEnumerable(Array.prototype, "join");
|
||||
verifyWritable(Array.prototype, "join");
|
||||
verifyConfigurable(Array.prototype, "join");
|
@ -1,11 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 15.4.4.15-0-1
|
||||
description: Array.prototype.lastIndexOf must exist as a function
|
||||
---*/
|
||||
|
||||
var f = Array.prototype.lastIndexOf;
|
||||
|
||||
assert.sameValue(typeof(f), "function", 'typeof(f)');
|
@ -1,9 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 15.4.4.15-0-2
|
||||
description: Array.prototype.lastIndexOf has a length property whose value is 1.
|
||||
---*/
|
||||
|
||||
assert.sameValue(Array.prototype.lastIndexOf.length, 1, 'Array.prototype.lastIndexOf.length');
|
28
test/built-ins/Array/prototype/lastIndexOf/length.js
vendored
Normal file
28
test/built-ins/Array/prototype/lastIndexOf/length.js
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.lastindexof
|
||||
description: >
|
||||
The "length" property of Array.prototype.lastIndexOf
|
||||
info: |
|
||||
17 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. Optional parameters (which are indicated with brackets:
|
||||
[ ]) or rest parameters (which are shown using the form «...name») are not
|
||||
included in the default argument count.
|
||||
|
||||
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.prototype.lastIndexOf.length, 1);
|
||||
|
||||
verifyNotEnumerable(Array.prototype.lastIndexOf, 'length');
|
||||
verifyNotWritable(Array.prototype.lastIndexOf, 'length');
|
||||
verifyConfigurable(Array.prototype.lastIndexOf, 'length');
|
21
test/built-ins/Array/prototype/lastIndexOf/prop-desc.js
vendored
Normal file
21
test/built-ins/Array/prototype/lastIndexOf/prop-desc.js
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.lastindexof
|
||||
description: >
|
||||
"lastIndexOf" property of Array.prototype
|
||||
info: |
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
Every other data property described in clauses 18 through 26 and in Annex B.2
|
||||
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
|
||||
[[Configurable]]: true } unless otherwise specified.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(typeof Array.prototype.lastIndexOf, 'function', 'typeof');
|
||||
|
||||
verifyNotEnumerable(Array.prototype, "lastIndexOf");
|
||||
verifyWritable(Array.prototype, "lastIndexOf");
|
||||
verifyConfigurable(Array.prototype, "lastIndexOf");
|
24
test/built-ins/Array/prototype/length.js
vendored
Normal file
24
test/built-ins/Array/prototype/length.js
vendored
Normal 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-properties-of-the-array-prototype-object
|
||||
description: >
|
||||
Array.prototype has a length property
|
||||
info: |
|
||||
22.1.3 Properties of the Array Prototype Object
|
||||
|
||||
The Array prototype object is the intrinsic object %ArrayPrototype%. The Array
|
||||
prototype object is an Array exotic object and has the internal methods specified
|
||||
for such objects. It has a length property whose initial value is 0 and whose
|
||||
attributes are { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]:
|
||||
false }.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Array.prototype.length, 0);
|
||||
|
||||
verifyNotEnumerable(Array.prototype, 'length');
|
||||
// specify the value so it avoids a RangeError while setting the length
|
||||
verifyWritable(Array.prototype, 'length', false, 42);
|
||||
verifyNotConfigurable(Array.prototype, 'length');
|
@ -1,11 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 15.4.4.19-0-1
|
||||
description: Array.prototype.map must exist as a function
|
||||
---*/
|
||||
|
||||
var f = Array.prototype.map;
|
||||
|
||||
assert.sameValue(typeof(f), "function", 'typeof(f)');
|
@ -1,9 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 15.4.4.19-0-2
|
||||
description: Array.prototype.map.length must be 1
|
||||
---*/
|
||||
|
||||
assert.sameValue(Array.prototype.map.length, 1, 'Array.prototype.map.length');
|
28
test/built-ins/Array/prototype/map/length.js
vendored
Normal file
28
test/built-ins/Array/prototype/map/length.js
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.map
|
||||
description: >
|
||||
The "length" property of Array.prototype.map
|
||||
info: |
|
||||
17 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. Optional parameters (which are indicated with brackets:
|
||||
[ ]) or rest parameters (which are shown using the form «...name») are not
|
||||
included in the default argument count.
|
||||
|
||||
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.prototype.map.length, 1);
|
||||
|
||||
verifyNotEnumerable(Array.prototype.map, 'length');
|
||||
verifyNotWritable(Array.prototype.map, 'length');
|
||||
verifyConfigurable(Array.prototype.map, 'length');
|
21
test/built-ins/Array/prototype/map/prop-desc.js
vendored
Normal file
21
test/built-ins/Array/prototype/map/prop-desc.js
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.map
|
||||
description: >
|
||||
"map" property of Array.prototype
|
||||
info: |
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
Every other data property described in clauses 18 through 26 and in Annex B.2
|
||||
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
|
||||
[[Configurable]]: true } unless otherwise specified.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(typeof Array.prototype.map, 'function', 'typeof');
|
||||
|
||||
verifyNotEnumerable(Array.prototype, "map");
|
||||
verifyWritable(Array.prototype, "map");
|
||||
verifyConfigurable(Array.prototype, "map");
|
@ -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 pop has the attribute DontEnum
|
||||
es5id: 15.4.4.6_A5.1
|
||||
description: Checking use propertyIsEnumerable, for-in
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.pop.propertyIsEnumerable('length') !== false) {
|
||||
$ERROR('#1: Array.prototype.pop.propertyIsEnumerable(\'length\') === false. Actual: ' + (Array.prototype.pop.propertyIsEnumerable('length')));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
var result = true;
|
||||
for (var p in Array.prototype.pop){
|
||||
if (p === "length") {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (result !== true) {
|
||||
$ERROR('#2: result = true; for (p in Array.prototype.pop) { if (p === "length") result = false; } result === true;');
|
||||
}
|
@ -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 pop does not have the attribute DontDelete
|
||||
es5id: 15.4.4.6_A5.2
|
||||
description: Checking use hasOwnProperty, delete
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.pop.hasOwnProperty('length') !== true) {
|
||||
$ERROR('#1: Array.prototype.pop.hasOwnProperty(\'length\') === true. Actual: ' + (Array.prototype.pop.hasOwnProperty('length')));
|
||||
}
|
||||
|
||||
delete Array.prototype.pop.length;
|
||||
|
||||
//CHECK#2
|
||||
if (Array.prototype.pop.hasOwnProperty('length') !== false) {
|
||||
$ERROR('#2: delete Array.prototype.pop.length; Array.prototype.pop.hasOwnProperty(\'length\') === false. Actual: ' + (Array.prototype.pop.hasOwnProperty('length')));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (Array.prototype.pop.length === undefined) {
|
||||
$ERROR('#3: delete Array.prototype.pop.length; Array.prototype.pop.length !== undefined');
|
||||
}
|
@ -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 pop has the attribute ReadOnly
|
||||
es5id: 15.4.4.6_A5.3
|
||||
description: Checking if varying the length property fails
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = Array.prototype.pop.length;
|
||||
verifyNotWritable(Array.prototype.pop, "length", null, Infinity);
|
||||
if (Array.prototype.pop.length !== x) {
|
||||
$ERROR('#1: x = Array.prototype.pop.length; Array.prototype.pop.length = Infinity; Array.prototype.pop.length === x. Actual: ' + (Array.prototype.pop.length));
|
||||
}
|
@ -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 pop is 0
|
||||
es5id: 15.4.4.6_A5.4
|
||||
description: pop.length === 1
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.pop.length !== 0) {
|
||||
$ERROR('#1: Array.prototype.pop.length === 0. Actual: ' + (Array.prototype.pop.length));
|
||||
}
|
@ -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 pop property of Array has the attribute DontEnum
|
||||
es5id: 15.4.4.6_A5.5
|
||||
description: Checking use propertyIsEnumerable, for-in
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.propertyIsEnumerable('pop') !== false) {
|
||||
$ERROR('#1: Array.propertyIsEnumerable(\'pop\') === false. Actual: ' + (Array.propertyIsEnumerable('pop')));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
var result = true;
|
||||
for (var p in Array){
|
||||
if (p === "pop") {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (result !== true) {
|
||||
$ERROR('#2: result = true; for (p in Array) { if (p === "pop") result = false; } result === true;');
|
||||
}
|
@ -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 pop property of Array has not prototype property
|
||||
es5id: 15.4.4.6_A5.6
|
||||
description: Checking Array.prototype.pop.prototype
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.pop.prototype !== undefined) {
|
||||
$ERROR('#1: Array.prototype.pop.prototype === undefined. Actual: ' + (Array.prototype.pop.prototype));
|
||||
}
|
28
test/built-ins/Array/prototype/pop/length.js
vendored
Normal file
28
test/built-ins/Array/prototype/pop/length.js
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.pop
|
||||
description: >
|
||||
The "length" property of Array.prototype.pop
|
||||
info: |
|
||||
17 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. Optional parameters (which are indicated with brackets:
|
||||
[ ]) or rest parameters (which are shown using the form «...name») are not
|
||||
included in the default argument count.
|
||||
|
||||
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.prototype.pop.length, 0);
|
||||
|
||||
verifyNotEnumerable(Array.prototype.pop, 'length');
|
||||
verifyNotWritable(Array.prototype.pop, 'length');
|
||||
verifyConfigurable(Array.prototype.pop, 'length');
|
21
test/built-ins/Array/prototype/pop/prop-desc.js
vendored
Normal file
21
test/built-ins/Array/prototype/pop/prop-desc.js
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.pop
|
||||
description: >
|
||||
"pop" property of Array.prototype
|
||||
info: |
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
Every other data property described in clauses 18 through 26 and in Annex B.2
|
||||
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
|
||||
[[Configurable]]: true } unless otherwise specified.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(typeof Array.prototype.pop, 'function', 'typeof');
|
||||
|
||||
verifyNotEnumerable(Array.prototype, "pop");
|
||||
verifyWritable(Array.prototype, "pop");
|
||||
verifyConfigurable(Array.prototype, "pop");
|
20
test/built-ins/Array/prototype/prop-desc.js
vendored
Normal file
20
test/built-ins/Array/prototype/prop-desc.js
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype
|
||||
description: >
|
||||
The property descriptor of Array.prototype
|
||||
info: |
|
||||
22.1.2.4 Array.prototype
|
||||
|
||||
The value of Array.prototype is %ArrayPrototype%, the intrinsic Array prototype object.
|
||||
|
||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
||||
[[Configurable]]: false }.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
verifyNotEnumerable(Array, 'prototype');
|
||||
verifyNotWritable(Array, 'prototype');
|
||||
verifyNotConfigurable(Array, 'prototype');
|
15
test/built-ins/Array/prototype/proto.js
vendored
Normal file
15
test/built-ins/Array/prototype/proto.js
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// 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-prototype-object
|
||||
description: >
|
||||
The [[Prototype]] of Array.prototype is Object.Prototype.
|
||||
info: |
|
||||
22.1.3 Properties of the Array Prototype Object
|
||||
|
||||
The value of the [[Prototype]] internal slot of the Array prototype object is
|
||||
the intrinsic object %ObjectPrototype%.
|
||||
---*/
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(Array.prototype), Object.prototype);
|
@ -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 push has the attribute DontEnum
|
||||
es5id: 15.4.4.7_A6.1
|
||||
description: Checking use propertyIsEnumerable, for-in
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.push.propertyIsEnumerable('length') !== false) {
|
||||
$ERROR('#1: Array.prototype.push.propertyIsEnumerable(\'length\') === false. Actual: ' + (Array.prototype.push.propertyIsEnumerable('length')));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
var result = true;
|
||||
for (var p in Array.prototype.push){
|
||||
if (p === "length") {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (result !== true) {
|
||||
$ERROR('#2: result = true; for (p in Array.prototype.push) { if (p === "length") result = false; } result === true;');
|
||||
}
|
@ -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 push does not have the attribute DontDelete
|
||||
es5id: 15.4.4.7_A6.2
|
||||
description: Checking use hasOwnProperty, delete
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.push.hasOwnProperty('length') !== true) {
|
||||
$ERROR('#1: Array.prototype.push.hasOwnProperty(\'length\') === true. Actual: ' + (Array.prototype.push.hasOwnProperty('length')));
|
||||
}
|
||||
|
||||
delete Array.prototype.push.length;
|
||||
|
||||
//CHECK#2
|
||||
if (Array.prototype.push.hasOwnProperty('length') !== false) {
|
||||
$ERROR('#2: delete Array.prototype.push.length; Array.prototype.push.hasOwnProperty(\'length\') === false. Actual: ' + (Array.prototype.push.hasOwnProperty('length')));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (Array.prototype.push.length === undefined) {
|
||||
$ERROR('#3: delete Array.prototype.push.length; Array.prototype.push.length !== undefined');
|
||||
}
|
@ -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 push has the attribute ReadOnly
|
||||
es5id: 15.4.4.7_A6.3
|
||||
description: Checking if varying the length property fails
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = Array.prototype.push.length;
|
||||
verifyNotWritable(Array.prototype.push, "length", null, Infinity);
|
||||
if (Array.prototype.push.length !== x) {
|
||||
$ERROR('#1: x = Array.prototype.push.length; Array.prototype.push.length = Infinity; Array.prototype.push.length === x. Actual: ' + (Array.prototype.push.length));
|
||||
}
|
@ -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 push is 1
|
||||
es5id: 15.4.4.7_A6.4
|
||||
description: push.length === 1
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.push.length !== 1) {
|
||||
$ERROR('#1: Array.prototype.push.length === 1. Actual: ' + (Array.prototype.push.length));
|
||||
}
|
@ -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 push property of Array has the attribute DontEnum
|
||||
es5id: 15.4.4.7_A6.5
|
||||
description: Checking use propertyIsEnumerable, for-in
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.propertyIsEnumerable('push') !== false) {
|
||||
$ERROR('#1: Array.propertyIsEnumerable(\'push\') === false. Actual: ' + (Array.propertyIsEnumerable('push')));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
var result = true;
|
||||
for (var p in Array){
|
||||
if (p === "push") {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (result !== true) {
|
||||
$ERROR('#2: result = true; for (p in Array) { if (p === "push") result = false; } result === true;');
|
||||
}
|
@ -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 push property of Array has not prototype property
|
||||
es5id: 15.4.4.7_A6.6
|
||||
description: Checking Array.prototype.push.prototype
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
if (Array.prototype.push.prototype !== undefined) {
|
||||
$ERROR('#1: Array.prototype.push.prototype === undefined. Actual: ' + (Array.prototype.push.prototype));
|
||||
}
|
32
test/built-ins/Array/prototype/push/length.js
vendored
Normal file
32
test/built-ins/Array/prototype/push/length.js
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.push
|
||||
description: >
|
||||
The "length" property of Array.prototype.push
|
||||
info: |
|
||||
22.1.3.18 Array.prototype.push ( ...items )
|
||||
|
||||
The length property of the push method is 1.
|
||||
|
||||
17 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. Optional parameters (which are indicated with brackets:
|
||||
[ ]) or rest parameters (which are shown using the form «...name») are not
|
||||
included in the default argument count.
|
||||
|
||||
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.prototype.push.length, 1);
|
||||
|
||||
verifyNotEnumerable(Array.prototype.push, 'length');
|
||||
verifyNotWritable(Array.prototype.push, 'length');
|
||||
verifyConfigurable(Array.prototype.push, 'length');
|
21
test/built-ins/Array/prototype/push/prop-desc.js
vendored
Normal file
21
test/built-ins/Array/prototype/push/prop-desc.js
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2017 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.push
|
||||
description: >
|
||||
"push" property of Array.prototype
|
||||
info: |
|
||||
17 ECMAScript Standard Built-in Objects
|
||||
|
||||
Every other data property described in clauses 18 through 26 and in Annex B.2
|
||||
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
|
||||
[[Configurable]]: true } unless otherwise specified.
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
assert.sameValue(typeof Array.prototype.push, 'function', 'typeof');
|
||||
|
||||
verifyNotEnumerable(Array.prototype, "push");
|
||||
verifyWritable(Array.prototype, "push");
|
||||
verifyConfigurable(Array.prototype, "push");
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user