mirror of
https://github.com/tc39/test262.git
synced 2025-07-21 21:14:45 +02:00
add esid to frontmatter for Array/length
This commit is contained in:
parent
2f4d0be4b8
commit
1341088b36
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-properties-of-array-instances-length
|
||||
es5id: 15.4.5.1-3.d-1
|
||||
description: >
|
||||
Throw RangeError if attempt to set array length property to
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-properties-of-array-instances-length
|
||||
es5id: 15.4.5.1-3.d-2
|
||||
description: >
|
||||
Throw RangeError if attempt to set array length property to
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-properties-of-array-instances-length
|
||||
es5id: 15.4.5.1-3.d-3
|
||||
description: Set array length property to max value 4294967295 (2**32-1,)
|
||||
---*/
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-len
|
||||
info: >
|
||||
The [[Prototype]] property of the newly constructed object
|
||||
is set to the original Array prototype object, the one that
|
||||
@ -14,7 +15,7 @@ description: >
|
||||
|
||||
//CHECK#1
|
||||
Array.prototype.myproperty = 1;
|
||||
var x = new Array(0);
|
||||
var x = new Array(0);
|
||||
if (x.myproperty !== 1) {
|
||||
$ERROR('#1: Array.prototype.myproperty = 1; var x = new Array(0); x.myproperty === 1. Actual: ' + (x.myproperty));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-len
|
||||
info: >
|
||||
The [[Prototype]] property of the newly constructed object
|
||||
is set to the original Array prototype object, the one that
|
||||
@ -12,7 +13,7 @@ description: Array.prototype.toString = Object.prototype.toString
|
||||
|
||||
//CHECK#1
|
||||
Array.prototype.toString = Object.prototype.toString;
|
||||
var x = new Array(0);
|
||||
var x = new Array(0);
|
||||
if (x.toString() !== "[object " + "Array" + "]") {
|
||||
$ERROR('#1: Array.prototype.toString = Object.prototype.toString; var x = new Array(0); x.toString() === "[object " + "Array" + "]". Actual: ' + (x.toString()));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-len
|
||||
info: >
|
||||
The [[Prototype]] property of the newly constructed object
|
||||
is set to the original Array prototype object, the one that
|
||||
|
@ -2,13 +2,14 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-len
|
||||
info: The [[Class]] property of the newly constructed object is set to "Array"
|
||||
es5id: 15.4.2.2_A1.2_T1
|
||||
description: Checking use Object.prototype.toString
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = new Array(0);
|
||||
var x = new Array(0);
|
||||
x.getClass = Object.prototype.toString;
|
||||
if (x.getClass() !== "[object " + "Array" + "]") {
|
||||
$ERROR('#1: var x = new Array(0); x.getClass = Object.prototype.toString; x is Array object. Actual: ' + (x.getClass()));
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-len
|
||||
info: >
|
||||
If the argument len is a Number and ToUint32(len) is equal to len,
|
||||
then the length property of the newly constructed object is set to ToUint32(len)
|
||||
@ -10,19 +11,19 @@ description: Array constructor is given one argument
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = new Array(0);
|
||||
var x = new Array(0);
|
||||
if (x.length !== 0) {
|
||||
$ERROR('#1: var x = new Array(0); x.length === 0. Actual: ' + (x.length));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
var x = new Array(1);
|
||||
var x = new Array(1);
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#2: var x = new Array(1); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
var x = new Array(4294967295);
|
||||
var x = new Array(4294967295);
|
||||
if (x.length !== 4294967295) {
|
||||
$ERROR('#3: var x = new Array(4294967295); x.length === 4294967295. Actual: ' + (x.length));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-len
|
||||
info: >
|
||||
If the argument len is a Number and ToUint32(len) is not equal to len,
|
||||
a RangeError exception is thrown
|
||||
@ -10,8 +11,8 @@ description: Use try statement. len = -1, 4294967296, 4294967297
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
try {
|
||||
new Array(-1);
|
||||
try {
|
||||
new Array(-1);
|
||||
$ERROR('#1.1: new Array(-1) throw RangeError. Actual: ' + (new Array(-1)));
|
||||
} catch(e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
@ -20,8 +21,8 @@ try {
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
try {
|
||||
new Array(4294967296);
|
||||
try {
|
||||
new Array(4294967296);
|
||||
$ERROR('#2.1: new Array(4294967296) throw RangeError. Actual: ' + (new Array(4294967296)));
|
||||
} catch(e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
@ -30,8 +31,8 @@ try {
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
try {
|
||||
new Array(4294967297);
|
||||
try {
|
||||
new Array(4294967297);
|
||||
$ERROR('#3.1: new Array(4294967297) throw RangeError. Actual: ' + (new Array(4294967297)));
|
||||
} catch(e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-len
|
||||
info: >
|
||||
If the argument len is a Number and ToUint32(len) is not equal to len,
|
||||
a RangeError exception is thrown
|
||||
@ -10,8 +11,8 @@ description: Use try statement. len = NaN, +/-Infinity
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
try {
|
||||
new Array(NaN);
|
||||
try {
|
||||
new Array(NaN);
|
||||
$ERROR('#1.1: new Array(NaN) throw RangeError. Actual: ' + (new Array(NaN)));
|
||||
} catch(e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
@ -20,8 +21,8 @@ try {
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
try {
|
||||
new Array(Number.POSITIVE_INFINITY);
|
||||
try {
|
||||
new Array(Number.POSITIVE_INFINITY);
|
||||
$ERROR('#2.1: new Array(Number.POSITIVE_INFINITY) throw RangeError. Actual: ' + (new Array(Number.POSITIVE_INFINITY)));
|
||||
} catch(e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
@ -30,8 +31,8 @@ try {
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
try {
|
||||
new Array(Number.NEGATIVE_INFINITY);
|
||||
try {
|
||||
new Array(Number.NEGATIVE_INFINITY);
|
||||
$ERROR('#3.1: new Array(Number.NEGATIVE_INFINITY) throw RangeError. Actual: ' + (new Array(Number.NEGATIVE_INFINITY)));
|
||||
} catch(e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-len
|
||||
info: >
|
||||
If the argument len is a Number and ToUint32(len) is not equal to len,
|
||||
a RangeError exception is thrown
|
||||
@ -10,8 +11,8 @@ description: Use try statement. len = 1.5, Number.MAX_VALUE, Number.MIN_VALUE
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
try {
|
||||
new Array(1.5);
|
||||
try {
|
||||
new Array(1.5);
|
||||
$ERROR('#1.1: new Array(1.5) throw RangeError. Actual: ' + (new Array(1.5)));
|
||||
} catch(e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
@ -20,8 +21,8 @@ try {
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
try {
|
||||
new Array(Number.MAX_VALUE);
|
||||
try {
|
||||
new Array(Number.MAX_VALUE);
|
||||
$ERROR('#2.1: new Array(Number.MAX_VALUE) throw RangeError. Actual: ' + (new Array(Number.MAX_VALUE)));
|
||||
} catch(e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
@ -30,8 +31,8 @@ try {
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
try {
|
||||
new Array(Number.MIN_VALUE);
|
||||
try {
|
||||
new Array(Number.MIN_VALUE);
|
||||
$ERROR('#3.1: new Array(Number.MIN_VALUE) throw RangeError. Actual: ' + (new Array(Number.MIN_VALUE)));
|
||||
} catch(e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-len
|
||||
info: >
|
||||
If the argument len is not a Number, then the length property of
|
||||
the newly constructed object is set to 1 and the 0 property of
|
||||
@ -12,7 +13,7 @@ description: Checking for null and undefined
|
||||
|
||||
var x = new Array(null);
|
||||
|
||||
//CHECK#1
|
||||
//CHECK#1
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#1: var x = new Array(null); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
@ -24,7 +25,7 @@ if (x[0] !== null) {
|
||||
|
||||
var x = new Array(undefined);
|
||||
|
||||
//CHECK#3
|
||||
//CHECK#3
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#3: var x = new Array(undefined); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-len
|
||||
info: >
|
||||
If the argument len is not a Number, then the length property of
|
||||
the newly constructed object is set to 1 and the 0 property of
|
||||
@ -12,7 +13,7 @@ description: Checking for boolean primitive and Boolean object
|
||||
|
||||
var x = new Array(true);
|
||||
|
||||
//CHECK#1
|
||||
//CHECK#1
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#1: var x = new Array(true); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
@ -25,7 +26,7 @@ if (x[0] !== true) {
|
||||
var obj = new Boolean(false);
|
||||
var x = new Array(obj);
|
||||
|
||||
//CHECK#3
|
||||
//CHECK#3
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#3: var obj = new Boolean(false); var x = new Array(obj); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-len
|
||||
info: >
|
||||
If the argument len is not a Number, then the length property of
|
||||
the newly constructed object is set to 1 and the 0 property of
|
||||
@ -12,7 +13,7 @@ description: Checking for boolean primitive and Boolean object
|
||||
|
||||
var x = new Array("1");
|
||||
|
||||
//CHECK#1
|
||||
//CHECK#1
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#1: var x = new Array("1"); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
@ -25,7 +26,7 @@ if (x[0] !== "1") {
|
||||
var obj = new String("0");
|
||||
var x = new Array(obj);
|
||||
|
||||
//CHECK#3
|
||||
//CHECK#3
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#3: var obj = new String("0"); var x = new Array(obj); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-len
|
||||
info: >
|
||||
If the argument len is not a Number, then the length property of
|
||||
the newly constructed object is set to 1 and the 0 property of
|
||||
@ -13,7 +14,7 @@ description: Checking for Number object
|
||||
var obj = new Number(0);
|
||||
var x = new Array(obj);
|
||||
|
||||
//CHECK#1
|
||||
//CHECK#1
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#1: var obj = new Number(0); var x = new Array(obj); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
@ -26,7 +27,7 @@ if (x[0] !== obj) {
|
||||
var obj = new Number(1);
|
||||
var x = new Array(obj);
|
||||
|
||||
//CHECK#3
|
||||
//CHECK#3
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#3: var obj = new Number(1); var x = new Array(obj); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
@ -39,7 +40,7 @@ if (x[0] !== obj) {
|
||||
var obj = new Number(4294967295);
|
||||
var x = new Array(obj);
|
||||
|
||||
//CHECK#5
|
||||
//CHECK#5
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#5: var obj = new Number(4294967295); var x = new Array(obj); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-len
|
||||
info: >
|
||||
If the argument len is not a Number, then the length property of
|
||||
the newly constructed object is set to 1 and the 0 property of
|
||||
@ -13,7 +14,7 @@ description: Checking for Number object
|
||||
var obj = new Number(-1);
|
||||
var x = new Array(obj);
|
||||
|
||||
//CHECK#1
|
||||
//CHECK#1
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#1: var obj = new Number(-1); var x = new Array(obj); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
@ -26,7 +27,7 @@ if (x[0] !== obj) {
|
||||
var obj = new Number(4294967296);
|
||||
var x = new Array(obj);
|
||||
|
||||
//CHECK#3
|
||||
//CHECK#3
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#3: var obj = new Number(4294967296); var x = new Array(obj); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
@ -39,7 +40,7 @@ if (x[0] !== obj) {
|
||||
var obj = new Number(4294967297);
|
||||
var x = new Array(obj);
|
||||
|
||||
//CHECK#5
|
||||
//CHECK#5
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#5: var obj = new Number(4294967297); var x = new Array(obj); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-properties-of-the-array-prototype-object
|
||||
info: Array prototype object has a length property
|
||||
es5id: 15.4.4_A1.3_T1
|
||||
description: Array.prototype.length === 0
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-exotic-objects-defineownproperty-p-desc
|
||||
info: If ToUint32(length) !== ToNumber(length), throw RangeError
|
||||
es5id: 15.4.5.1_A1.1_T1
|
||||
description: length in [4294967296, -1, 1.5]
|
||||
@ -12,10 +13,10 @@ try {
|
||||
var x = [];
|
||||
x.length = 4294967296;
|
||||
$ERROR('#1.1: x = []; x.length = 4294967296 throw RangeError. Actual: x.length === ' + (x.length));
|
||||
} catch(e) {
|
||||
} catch(e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
$ERROR('#1.2: x = []; x.length = 4294967296 throw RangeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
@ -23,10 +24,10 @@ try {
|
||||
x = [];
|
||||
x.length = -1;
|
||||
$ERROR('#2.1: x = []; x.length = -1 throw RangeError. Actual: x.length === ' + (x.length));
|
||||
} catch(e) {
|
||||
} catch(e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
$ERROR('#2.2: x = []; x.length = -1 throw RangeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
@ -34,8 +35,8 @@ try {
|
||||
x = [];
|
||||
x.length = 1.5;
|
||||
$ERROR('#3.1: x = []; x.length = 1.5 throw RangeError. Actual: x.length === ' + (x.length));
|
||||
} catch(e) {
|
||||
} catch(e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
$ERROR('#3.2: x = []; x.length = 1.5 throw RangeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-exotic-objects-defineownproperty-p-desc
|
||||
info: If ToUint32(length) !== ToNumber(length), throw RangeError
|
||||
es5id: 15.4.5.1_A1.1_T2
|
||||
description: length in [NaN, Infinity, -Infinity, undefined]
|
||||
@ -12,10 +13,10 @@ try {
|
||||
var x = [];
|
||||
x.length = NaN;
|
||||
$ERROR('#1.1: x = []; x.length = NaN throw RangeError. Actual: x.length === ' + (x.length));
|
||||
} catch(e) {
|
||||
} catch(e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
$ERROR('#1.2: x = []; x.length = NaN throw RangeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
@ -23,10 +24,10 @@ try {
|
||||
x = [];
|
||||
x.length = Number.POSITIVE_INFINITY;
|
||||
$ERROR('#2.1: x = []; x.length = Number.POSITIVE_INFINITY throw RangeError. Actual: x.length === ' + (x.length));
|
||||
} catch(e) {
|
||||
} catch(e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
$ERROR('#2.2: x = []; x.length = Number.POSITIVE_INFINITY throw RangeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
@ -34,10 +35,10 @@ try {
|
||||
x = [];
|
||||
x.length = Number.NEGATIVE_INFINITY;
|
||||
$ERROR('#3.1: x = []; x.length = Number.NEGATIVE_INFINITY throw RangeError. Actual: x.length === ' + (x.length));
|
||||
} catch(e) {
|
||||
} catch(e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
$ERROR('#3.2: x = []; x.length = Number.NEGATIVE_INFINITY throw RangeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
@ -45,8 +46,8 @@ try {
|
||||
x = [];
|
||||
x.length = undefined;
|
||||
$ERROR('#4.1: x = []; x.length = undefined throw RangeError. Actual: x.length === ' + (x.length));
|
||||
} catch(e) {
|
||||
} catch(e) {
|
||||
if ((e instanceof RangeError) !== true) {
|
||||
$ERROR('#4.2: x = []; x.length = undefined throw RangeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-exotic-objects-defineownproperty-p-desc
|
||||
info: >
|
||||
For every integer k that is less than the value of
|
||||
the length property of A but not less than ToUint32(length),
|
||||
@ -14,17 +15,17 @@ description: Change length of array
|
||||
//CHECK#1
|
||||
var x = [0,,2,,4];
|
||||
x.length = 4;
|
||||
if (x[4] !== undefined) {
|
||||
$ERROR('#1: x = [0,,2,,4]; x.length = 4; x[4] === undefined. Actual: ' + (x[4]));
|
||||
if (x[4] !== undefined) {
|
||||
$ERROR('#1: x = [0,,2,,4]; x.length = 4; x[4] === undefined. Actual: ' + (x[4]));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
x.length = 3;
|
||||
if (x[3] !== undefined) {
|
||||
$ERROR('#2: x = [0,,2,,4]; x.length = 4; x.length = 3; x[3] === undefined. Actual: ' + (x[3]));
|
||||
if (x[3] !== undefined) {
|
||||
$ERROR('#2: x = [0,,2,,4]; x.length = 4; x.length = 3; x[3] === undefined. Actual: ' + (x[3]));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (x[2] !== 2) {
|
||||
$ERROR('#3: x = [0,,2,,4]; x.length = 4; x.length = 3; x[2] === 2. Actual: ' + (x[2]));
|
||||
if (x[2] !== 2) {
|
||||
$ERROR('#3: x = [0,,2,,4]; x.length = 4; x.length = 3; x[2] === 2. Actual: ' + (x[2]));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-exotic-objects-defineownproperty-p-desc
|
||||
info: >
|
||||
For every integer k that is less than the value of
|
||||
the length property of A but not less than ToUint32(length),
|
||||
@ -15,12 +16,12 @@ description: Checking an inherited property
|
||||
Array.prototype[2] = 2;
|
||||
var x = [0,1];
|
||||
x.length = 3;
|
||||
if (x.hasOwnProperty('2') !== false) {
|
||||
$ERROR('#1: Array.prototype[2] = 2; x = [0,1]; x.length = 3; x.hasOwnProperty(\'2\') === false. Actual: ' + (x.hasOwnProperty('2')));
|
||||
if (x.hasOwnProperty('2') !== false) {
|
||||
$ERROR('#1: Array.prototype[2] = 2; x = [0,1]; x.length = 3; x.hasOwnProperty(\'2\') === false. Actual: ' + (x.hasOwnProperty('2')));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
x.length = 2;
|
||||
if (x[2] !== 2) {
|
||||
$ERROR('#2: Array.prototype[2] = 2; x = [0,1]; x.length = 3; x.length = 2; x[2] === 2. Actual: ' + (x[2]));
|
||||
if (x[2] !== 2) {
|
||||
$ERROR('#2: Array.prototype[2] = 2; x = [0,1]; x.length = 3; x.length = 2; x[2] === 2. Actual: ' + (x[2]));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-exotic-objects-defineownproperty-p-desc
|
||||
info: Set the value of property length of A to Uint32(length)
|
||||
es5id: 15.4.5.1_A1.3_T1
|
||||
description: length is object or primitve
|
||||
@ -10,41 +11,41 @@ description: length is object or primitve
|
||||
//CHECK#1
|
||||
var x = [];
|
||||
x.length = true;
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#1: x = []; x.length = true; x.length === 1. Actual: ' + (x.length));
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#1: x = []; x.length = true; x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
x = [0];
|
||||
x.length = null;
|
||||
if (x.length !== 0) {
|
||||
$ERROR('#2: x = [0]; x.length = null; x.length === 0. Actual: ' + (x.length));
|
||||
if (x.length !== 0) {
|
||||
$ERROR('#2: x = [0]; x.length = null; x.length === 0. Actual: ' + (x.length));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
x = [0];
|
||||
x.length = new Boolean(false);
|
||||
if (x.length !== 0) {
|
||||
$ERROR('#3: x = [0]; x.length = new Boolean(false); x.length === 0. Actual: ' + (x.length));
|
||||
if (x.length !== 0) {
|
||||
$ERROR('#3: x = [0]; x.length = new Boolean(false); x.length === 0. Actual: ' + (x.length));
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
x = [];
|
||||
x.length = new Number(1);
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#4: x = []; x.length = new Number(1); x.length === 1. Actual: ' + (x.length));
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#4: x = []; x.length = new Number(1); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
x = [];
|
||||
x.length = "1";
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#5: x = []; x.length = "1"; x.length === 1. Actual: ' + (x.length));
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#5: x = []; x.length = "1"; x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
x = [];
|
||||
x.length = new String("1");
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#6: x = []; x.length = new String("1"); x.length === 1. Actual: ' + (x.length));
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#6: x = []; x.length = new String("1"); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array-exotic-objects-defineownproperty-p-desc
|
||||
info: Set the value of property length of A to Uint32(length)
|
||||
es5id: 15.4.5.1_A1.3_T2
|
||||
description: Uint32 use ToNumber and ToPrimitve
|
||||
@ -19,7 +20,7 @@ x = [];
|
||||
x.length = {valueOf: function() {return 2}, toString: function() {return 1}};
|
||||
if (x.length !== 2) {
|
||||
$ERROR('#0: x = []; x.length = {valueOf: function() {return 2}, toString: function() {return 1}}; x.length === 2. Actual: ' + (x.length));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
x = [];
|
||||
@ -29,9 +30,9 @@ if (x.length !== 2) {
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
try {
|
||||
try {
|
||||
x = [];
|
||||
x.length = {valueOf: function() {return 2}, toString: function() {throw "error"}};
|
||||
x.length = {valueOf: function() {return 2}, toString: function() {throw "error"}};
|
||||
if (x.length !== 2) {
|
||||
$ERROR('#4.1: x = []; x.length = {valueOf: function() {return 2}, toString: function() {throw "error"}}; x.length === ",". Actual: ' + (x.length));
|
||||
}
|
||||
@ -61,14 +62,14 @@ if (x.length !== 1) {
|
||||
//CHECK#7
|
||||
try {
|
||||
x = [];
|
||||
x.length = {valueOf: function() {throw "error"}, toString: function() {return 1}};
|
||||
x.length = {valueOf: function() {throw "error"}, toString: function() {return 1}};
|
||||
x.length;
|
||||
$ERROR('#7.1: x = []; x.length = {valueOf: function() {throw "error"}, toString: function() {return 1}}; x.length throw "error". Actual: ' + (x.length));
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
if (e !== "error") {
|
||||
$ERROR('#7.2: x = []; x.length = {valueOf: function() {throw "error"}, toString: function() {return 1}}; x.length throw "error". Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#8
|
||||
@ -77,9 +78,9 @@ try {
|
||||
x.length = {valueOf: function() {return {}}, toString: function() {return {}}};
|
||||
x.length;
|
||||
$ERROR('#8.1: x = []; x.length = {valueOf: function() {return {}}, toString: function() {return {}}} x.length throw TypeError. Actual: ' + (x.length));
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
$ERROR('#8.2: x = []; x.length = {valueOf: function() {return {}}, toString: function() {return {}}} x.length throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-properties-of-array-instances-length
|
||||
info: >
|
||||
If the length property is changed, every property whose name
|
||||
is an array index whose value is not smaller than the new length is automatically deleted
|
||||
@ -12,26 +13,26 @@ description: >
|
||||
---*/
|
||||
|
||||
//CHECK#1
|
||||
var x = [0,1,2];
|
||||
x[4294967294] = 4294967294;
|
||||
var x = [0,1,2];
|
||||
x[4294967294] = 4294967294;
|
||||
x.length = 2;
|
||||
|
||||
//CHECK#1
|
||||
if (x[0] !== 0) {
|
||||
$ERROR('#1: x = [0,1,2]; x[4294967294] = 4294967294; x.length = 2; x[0] === 0. Actual: ' + (x[0]));
|
||||
if (x[0] !== 0) {
|
||||
$ERROR('#1: x = [0,1,2]; x[4294967294] = 4294967294; x.length = 2; x[0] === 0. Actual: ' + (x[0]));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (x[1] !== 1) {
|
||||
$ERROR('#2: x = [0,1,2]; x[4294967294] = 4294967294; x.length = 2; x[1] === 1. Actual: ' + (x[1]));
|
||||
if (x[1] !== 1) {
|
||||
$ERROR('#2: x = [0,1,2]; x[4294967294] = 4294967294; x.length = 2; x[1] === 1. Actual: ' + (x[1]));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (x[2] !== undefined) {
|
||||
$ERROR('#3: x = [0,1,2]; x[4294967294] = 4294967294; x.length = 2; x[2] === undefined. Actual: ' + (x[2]));
|
||||
if (x[2] !== undefined) {
|
||||
$ERROR('#3: x = [0,1,2]; x[4294967294] = 4294967294; x.length = 2; x[2] === undefined. Actual: ' + (x[2]));
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (x[4294967294] !== undefined) {
|
||||
$ERROR('#4: x = [0,1,2]; x[4294967294] = 4294967294; x.length = 2; x[4294967294] === undefined. Actual: ' + (x[4294967294]));
|
||||
if (x[4294967294] !== undefined) {
|
||||
$ERROR('#4: x = [0,1,2]; x[4294967294] = 4294967294; x.length = 2; x[4294967294] === undefined. Actual: ' + (x[4294967294]));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user