Automated assertion message update: Array * (#3140)

* Automated assertion message update: Array.from

* Automated assertion message update: Array.isArray

* Automated assertion message update: Array length property

* Automated assertion message update: Array.of

* Automated assertion message update: Array

* Automated assertion message update: Array.prototype.at

* Automated assertion message update: Array.prototype.concat

* Automated assertion message update: compareArray -> assert.compareArray
This commit is contained in:
Rick Waldron 2021-08-10 17:51:54 -04:00 committed by GitHub
parent bb93efdb6b
commit 452c0e5c61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
288 changed files with 1618 additions and 2115 deletions

View File

@ -9,4 +9,4 @@ description: Array instances have [[Class]] set to 'Array'
var a = [];
var s = Object.prototype.toString.call(a);
assert.sameValue(s, '[object Array]', 's');
assert.sameValue(s, '[object Array]', 'The value of s is expected to be "[object Array]"');

View File

@ -11,4 +11,4 @@ description: >
var a = [];
a[4294967295] = "not an array element";
assert.sameValue(a[4294967295], "not an array element", 'a[4294967295]');
assert.sameValue(a[4294967295], "not an array element", 'The value of a[4294967295] is expected to be "not an array element"');

View File

@ -11,4 +11,4 @@ description: >
var a = [0, 1, 2];
a[4294967295] = "not an array element";
assert.sameValue(a.length, 3, 'a.length');
assert.sameValue(a.length, 3, 'The value of a.length is expected to be 3');

View File

@ -15,6 +15,10 @@ description: >
//CHECK#1
Array.prototype.myproperty = 42;
var x = Array();
assert.sameValue(x.myproperty, 42);
assert.sameValue(x.myproperty, 42, 'The value of x.myproperty is expected to be 42');
assert.sameValue(Object.prototype.hasOwnProperty.call(x, 'myproperty'), false);
assert.sameValue(
Object.prototype.hasOwnProperty.call(x, 'myproperty'),
false,
'Object.prototype.hasOwnProperty.call(Array(), "myproperty") must return false'
);

View File

@ -13,13 +13,9 @@ description: Array.prototype.toString = Object.prototype.toString
//CHECK#1
Array.prototype.toString = Object.prototype.toString;
var x = Array();
if (x.toString() !== "[object " + "Array" + "]") {
throw new Test262Error('#1: Array.prototype.toString = Object.prototype.toString; var x = Array(); x.toString() === "[object " + "Array" + "]". Actual: ' + (x.toString()));
}
assert.sameValue(x.toString(), "[object Array]", 'x.toString() must return "[object Array]"');
//CHECK#2
Array.prototype.toString = Object.prototype.toString;
var x = Array(0, 1, 2);
if (x.toString() !== "[object " + "Array" + "]") {
throw new Test262Error('#2: Array.prototype.toString = Object.prototype.toString; var x = Array(0,1,2); x.toString() === "[object " + "Array" + "]". Actual: ' + (x.toString()));
}
assert.sameValue(x.toString(), "[object Array]", 'x.toString() must return "[object Array]"');

View File

@ -10,7 +10,8 @@ es5id: 15.4.1_A1.1_T3
description: Checking use isPrototypeOf
---*/
//CHECK#1
if (Array.prototype.isPrototypeOf(Array()) !== true) {
throw new Test262Error('#1: Array.prototype.isPrototypeOf(Array()) === true. Actual: ' + (Array.prototype.isPrototypeOf(Array())));
}
assert.sameValue(
Array.prototype.isPrototypeOf(Array()),
true,
'Array.prototype.isPrototypeOf(Array()) must return true'
);

View File

@ -10,13 +10,9 @@ description: Checking use Object.prototype.toString
//CHECK#1
var x = Array();
x.getClass = Object.prototype.toString;
if (x.getClass() !== "[object " + "Array" + "]") {
throw new Test262Error('#1: var x = Array(); x.getClass = Object.prototype.toString; x is Array object. Actual: ' + (x.getClass()));
}
assert.sameValue(x.getClass(), "[object Array]", 'x.getClass() must return "[object Array]"');
//CHECK#2
var x = Array(0, 1, 2);
x.getClass = Object.prototype.toString;
if (x.getClass() !== "[object " + "Array" + "]") {
throw new Test262Error('#2: var x = Array(0,1,2); x.getClass = Object.prototype.toString; x is Array object. Actual: ' + (x.getClass()));
}
assert.sameValue(x.getClass(), "[object Array]", 'x.getClass() must return "[object Array]"');

View File

@ -11,12 +11,5 @@ description: Checking case when Array constructor is given one argument
var x = Array(2);
//CHECK#1
if (x.length === 1) {
throw new Test262Error('#1: var x = Array(2); x.length !== 1');
}
//CHECK#2
if (x[0] === 2) {
throw new Test262Error('#2: var x = Array(2); x[0] !== 2');
}
assert.notSameValue(x.length, 1, 'The value of x.length is not 1');
assert.notSameValue(x[0], 2, 'The value of x[0] is not 2');

View File

@ -8,18 +8,11 @@ info: |
es5id: 15.4.1_A2.1_T1
description: Array constructor is given no arguments or at least two arguments
---*/
assert.sameValue(Array().length, 0, 'The value of Array().length is expected to be 0');
assert.sameValue(Array(0, 1, 0, 1).length, 4, 'The value of Array(0, 1, 0, 1).length is expected to be 4');
//CHECK#1
if (Array().length !== 0) {
throw new Test262Error('#1: (Array().length === 0. Actual: ' + (Array().length));
}
//CHECK#2
if (Array(0, 1, 0, 1).length !== 4) {
throw new Test262Error('#2: (Array(0,1,0,1).length === 4. Actual: ' + (Array(0, 1, 0, 1).length));
}
//CHECK#3
if (Array(undefined, undefined).length !== 2) {
throw new Test262Error('#3: (Array(undefined, undefined).length === 2. Actual: ' + (Array(undefined, undefined).length));
}
assert.sameValue(
Array(undefined, undefined).length,
2,
'The value of Array(undefined, undefined).length is expected to be 2'
);

View File

@ -33,6 +33,4 @@ for (var i = 0; i < 100; i++) {
}
}
if (result !== true) {
throw new Test262Error('#1: x[i] === i. Actual: ' + (x[i]));
}
assert.sameValue(result, true, 'The value of result is expected to be true');

View File

@ -9,12 +9,10 @@ es5id: 15.4.1_A3.1_T1
description: Checking use typeof, instanceof
---*/
//CHECK#1
if (typeof Array() !== "object") {
throw new Test262Error('#1: typeof Array() === "object". Actual: ' + (typeof Array()));
}
assert.sameValue(typeof Array(), "object", 'The value of `typeof Array()` is expected to be "object"');
//CHECK#2
if ((Array() instanceof Array) !== true) {
throw new Test262Error('#2: (Array() instanceof Array) === true. Actual: ' + (Array() instanceof Array));
}
assert.sameValue(
Array() instanceof Array,
true,
'The result of evaluating (Array() instanceof Array) is expected to be true'
);

View File

@ -15,11 +15,5 @@ description: >
//CHECK#1
Array.prototype.myproperty = 1;
var x = new Array();
if (x.myproperty !== 1) {
throw new Test262Error('#1: Array.prototype.myproperty = 1; var x = new Array(); x.myproperty === 1. Actual: ' + (x.myproperty));
}
//CHECK#2
if (x.hasOwnProperty('myproperty') !== false) {
throw new Test262Error('#2: Array.prototype.myproperty = 1; var x = new Array(); x.hasOwnProperty(\'myproperty\') === false. Actual: ' + (x.hasOwnProperty('myproperty')));
}
assert.sameValue(x.myproperty, 1, 'The value of x.myproperty is expected to be 1');
assert.sameValue(x.hasOwnProperty('myproperty'), false, 'x.hasOwnProperty("myproperty") must return false');

View File

@ -13,13 +13,9 @@ description: Array.prototype.toString = Object.prototype.toString
//CHECK#1
Array.prototype.toString = Object.prototype.toString;
var x = new Array();
if (x.toString() !== "[object " + "Array" + "]") {
throw new Test262Error('#1: Array.prototype.toString = Object.prototype.toString; var x = new Array(); x.toString() === "[object " + "Array" + "]". Actual: ' + (x.toString()));
}
assert.sameValue(x.toString(), "[object Array]", 'x.toString() must return "[object Array]"');
//CHECK#2
Array.prototype.toString = Object.prototype.toString;
var x = new Array(0, 1, 2);
if (x.toString() !== "[object " + "Array" + "]") {
throw new Test262Error('#2: Array.prototype.toString = Object.prototype.toString; var x = new Array(0,1,2); x.toString() === "[object " + "Array" + "]". Actual: ' + (x.toString()));
}
assert.sameValue(x.toString(), "[object Array]", 'x.toString() must return "[object Array]"');

View File

@ -9,8 +9,8 @@ info: |
es5id: 15.4.2.1_A1.1_T3
description: Checking use isPrototypeOf
---*/
//CHECK#1
if (Array.prototype.isPrototypeOf(new Array()) !== true) {
throw new Test262Error('#1: Array.prototype.isPrototypeOf(new Array()) === true. Actual: ' + (Array.prototype.isPrototypeOf(new Array())));
}
assert.sameValue(
Array.prototype.isPrototypeOf(new Array()),
true,
'Array.prototype.isPrototypeOf(new Array()) must return true'
);

View File

@ -10,13 +10,9 @@ description: Checking use Object.prototype.toString
//CHECK#1
var x = new Array();
x.getClass = Object.prototype.toString;
if (x.getClass() !== "[object " + "Array" + "]") {
throw new Test262Error('#1: var x = new Array(); x.getClass = Object.prototype.toString; x is Array object. Actual: ' + (x.getClass()));
}
assert.sameValue(x.getClass(), "[object Array]", 'x.getClass() must return "[object Array]"');
//CHECK#2
var x = new Array(0, 1, 2);
x.getClass = Object.prototype.toString;
if (x.getClass() !== "[object " + "Array" + "]") {
throw new Test262Error('#2: var x = new Array(0,1,2); x.getClass = Object.prototype.toString; x is Array object. Actual: ' + (x.getClass()));
}
assert.sameValue(x.getClass(), "[object Array]", 'x.getClass() must return "[object Array]"');

View File

@ -11,12 +11,5 @@ description: Checking case when Array constructor is given one argument
var x = new Array(2);
//CHECK#1
if (x.length === 1) {
throw new Test262Error('#1: var x = new Array(2); x.length !== 1');
}
//CHECK#2
if (x[0] === 2) {
throw new Test262Error('#2: var x = new Array(2); x[0] !== 2');
}
assert.notSameValue(x.length, 1, 'The value of x.length is not 1');
assert.notSameValue(x[0], 2, 'The value of x[0] is not 2');

View File

@ -8,18 +8,11 @@ info: |
es5id: 15.4.2.1_A2.1_T1
description: Array constructor is given no arguments or at least two arguments
---*/
assert.sameValue(new Array().length, 0, 'The value of new Array().length is expected to be 0');
assert.sameValue(new Array(0, 1, 0, 1).length, 4, 'The value of new Array(0, 1, 0, 1).length is expected to be 4');
//CHECK#1
if (new Array().length !== 0) {
throw new Test262Error('#1: new Array().length === 0. Actual: ' + (new Array().length));
}
//CHECK#2
if (new Array(0, 1, 0, 1).length !== 4) {
throw new Test262Error('#2: new Array(0,1,0,1).length === 4. Actual: ' + (new Array(0, 1, 0, 1).length));
}
//CHECK#3
if (new Array(undefined, undefined).length !== 2) {
throw new Test262Error('#3: new Array(undefined, undefined).length === 2. Actual: ' + (new Array(undefined, undefined).length));
}
assert.sameValue(
new Array(undefined, undefined).length,
2,
'The value of new Array(undefined, undefined).length is expected to be 2'
);

View File

@ -33,6 +33,4 @@ for (var i = 0; i < 100; i++) {
}
}
if (result !== true) {
throw new Test262Error('#1: x[i] === i. Actual: ' + (x[i]));
}
assert.sameValue(result, true, 'The value of result is expected to be true');

View File

@ -13,12 +13,5 @@ description: >
Function.prototype.myproperty = 1;
//CHECK#1
if (Array.myproperty !== 1) {
throw new Test262Error('#1: Function.prototype.myproperty = 1; Array.myproperty === 1. Actual: ' + (Array.myproperty));
}
//CHECK#2
if (Array.hasOwnProperty('myproperty') !== false) {
throw new Test262Error('#2: Function.prototype.myproperty = 1; Array.hasOwnProperty(\'myproperty\') === false. Actual: ' + (Array.hasOwnProperty('myproperty')));
}
assert.sameValue(Array.myproperty, 1, 'The value of Array.myproperty is expected to be 1');
assert.sameValue(Array.hasOwnProperty('myproperty'), false, 'Array.hasOwnProperty("myproperty") must return false');

View File

@ -11,6 +11,9 @@ description: Function.prototype.toString = Object.prototype.toString
//CHECK#1
Function.prototype.toString = Object.prototype.toString;
if (Array.toString() !== "[object " + "Function" + "]") {
throw new Test262Error('#1: Function.prototype.toString = Object.prototype.toString; Array.toString() === "[object " + "Function" + "]". Actual: ' + (Array.toString()));
}
assert.sameValue(
Array.toString(),
"[object Function]",
'Array.toString() must return "[object Function]"'
);

View File

@ -8,8 +8,8 @@ info: |
es5id: 15.4.3_A1.1_T3
description: Checking use isPrototypeOf
---*/
//CHECK#1
if (Function.prototype.isPrototypeOf(Array) !== true) {
throw new Test262Error('#1: Function.prototype.isPrototypeOf(Array) === true. Actual: ' + (Function.prototype.isPrototypeOf(Array)));
}
assert.sameValue(
Function.prototype.isPrototypeOf(Array),
true,
'Function.prototype.isPrototypeOf(Array) must return true'
);

View File

@ -14,12 +14,8 @@ description: Checking an inherited property
//CHECK#1
Array.prototype[2] = -1;
var x = [0, 1, 2];
if (x[2] !== 2) {
throw new Test262Error('#1: Array.prototype[2] = -1; x = [0,1,3]; x[2] === 2. Actual: ' + (x[2]));
}
assert.sameValue(x[2], 2, 'The value of x[2] is expected to be 2');
//CHECK#2
x.length = 2;
if (x[2] !== -1) {
throw new Test262Error('#2: Array.prototype[2] = -1; x = [0,1,3]; x.length = 2; x[2] === -1. Actual: ' + (x[2]));
}
assert.sameValue(x[2], -1, 'The value of x[2] is expected to be -1');

View File

@ -12,32 +12,17 @@ description: P in [4294967295, -1, true]
//CHECK#1
var x = [];
x[4294967295] = 1;
if (x.length !== 0) {
throw new Test262Error('#1.1: x = []; x[4294967295] = 1; x.length === 0. Actual: ' + (x.length));
}
if (x[4294967295] !== 1) {
throw new Test262Error('#1.2: x = []; x[4294967295] = 1; x[4294967295] === 1. Actual: ' + (x[4294967295]));
}
assert.sameValue(x.length, 0, 'The value of x.length is expected to be 0');
assert.sameValue(x[4294967295], 1, 'The value of x[4294967295] is expected to be 1');
//CHECK#2
x = [];
x[-1] = 1;
if (x.length !== 0) {
throw new Test262Error('#2.1: x = []; x[-1] = 1; x.length === 0. Actual: ' + (x.length));
}
if (x[-1] !== 1) {
throw new Test262Error('#2.2: x = []; x[-1] = 1; x[-1] === 1. Actual: ' + (x[-1]));
}
assert.sameValue(x.length, 0, 'The value of x.length is expected to be 0');
assert.sameValue(x[-1], 1, 'The value of x[-1] is expected to be 1');
//CHECK#3
x = [];
x[true] = 1;
if (x.length !== 0) {
throw new Test262Error('#3.1: x = []; x[true] = 1; x.length === 0. Actual: ' + (x.length));
}
if (x[true] !== 1) {
throw new Test262Error('#3.2: x = []; x[true] = 1; x[true] === 1. Actual: ' + (x[true]));
}
assert.sameValue(x.length, 0, 'The value of x.length is expected to be 0');
assert.sameValue(x[true], 1, 'The value of x[true] is expected to be 1');

View File

@ -12,18 +12,12 @@ description: length === 100, P in [0, 98, 99]
//CHECK#1
var x = Array(100);
x[0] = 1;
if (x.length !== 100) {
throw new Test262Error('#1: x = Array(100); x[0] = 1; x.length === 100. Actual: ' + (x.length));
}
assert.sameValue(x.length, 100, 'The value of x.length is expected to be 100');
//CHECK#2
x[98] = 1;
if (x.length !== 100) {
throw new Test262Error('#2: x = Array(100); x[0] = 1; x[98] = 1; x.length === 100. Actual: ' + (x.length));
}
assert.sameValue(x.length, 100, 'The value of x.length is expected to be 100');
//CHECK#3
x[99] = 1;
if (x.length !== 100) {
throw new Test262Error('#3: x = Array(100); x[0] = 1; x[98] = 1; x[99] = 1; x.length === 100. Actual: ' + (x.length));
}
assert.sameValue(x.length, 100, 'The value of x.length is expected to be 100');

View File

@ -12,12 +12,8 @@ description: length = 100, P in [100, 199]
//CHECK#1
var x = Array(100);
x[100] = 1;
if (x.length !== 101) {
throw new Test262Error('#1: x = Array(100); x[100] = 1; x.length === 101. Actual: ' + (x.length));
}
assert.sameValue(x.length, 101, 'The value of x.length is expected to be 101');
//CHECK#2
x[199] = 1;
if (x.length !== 200) {
throw new Test262Error('#2: x = Array(100); x[100] = 1; x[199] = 1; x.length === 100. Actual: ' + (x.length));
}
assert.sameValue(x.length, 200, 'The value of x.length is expected to be 200');

View File

@ -12,30 +12,20 @@ description: Checking boundary points
//CHECK#1
var x = [];
if (x.length !== 0) {
throw new Test262Error('#1: x = []; x.length === 0. Actual: ' + (x.length));
}
assert.sameValue(x.length, 0, 'The value of x.length is expected to be 0');
//CHECK#2
x[0] = 1;
if (x.length !== 1) {
throw new Test262Error('#2: x = []; x[1] = 1; x.length === 1. Actual: ' + (x.length));
}
assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
//CHECK#3
x[1] = 1;
if (x.length !== 2) {
throw new Test262Error('#3: x = []; x[0] = 1; x[1] = 1; x.length === 2. Actual: ' + (x.length));
}
assert.sameValue(x.length, 2, 'The value of x.length is expected to be 2');
//CHECK#4
x[2147483648] = 1;
if (x.length !== 2147483649) {
throw new Test262Error('#4: x = []; x[0] = 1; x[1] = 1; x[2147483648] = 1; x.length === 2147483649. Actual: ' + (x.length));
}
assert.sameValue(x.length, 2147483649, 'The value of x.length is expected to be 2147483649');
//CHECK#5
x[4294967294] = 1;
if (x.length !== 4294967295) {
throw new Test262Error('#5: x = []; x[0] = 1; x[1] = 1; x[2147483648] = 1; x[42949672954] = 1; x.length === 4294967295. Actual: ' + (x.length));
}
assert.sameValue(x.length, 4294967295, 'The value of x.length is expected to be 4294967295');

View File

@ -13,14 +13,10 @@ description: P = "2^32 - 1" is not index array
//CHECK#1
var x = [];
x[4294967295] = 1;
if (x.length !== 0) {
throw new Test262Error('#1: x = []; x[4294967295] = 1; x.length === 0. Actual: ' + (x.length));
}
assert.sameValue(x.length, 0, 'The value of x.length is expected to be 0');
//CHECK#2
var y = [];
y[1] = 1;
y[4294967295] = 1;
if (y.length !== 2) {
throw new Test262Error('#2: y = []; y[1] = 1; y[4294967295] = 1; y.length === 2. Actual: ' + (y.length));
}
assert.sameValue(y.length, 2, 'The value of y.length is expected to be 2');

View File

@ -11,24 +11,16 @@ description: Checking length property
//CHECK#1
var x = [];
if (x.length !== 0) {
throw new Test262Error('#1: x = []; x.length === 0. Actual: ' + (x.length));
}
assert.sameValue(x.length, 0, 'The value of x.length is expected to be 0');
//CHECK#2
x[0] = 1;
if (x.length !== 1) {
throw new Test262Error('#2: x = []; x[1] = 1; x.length === 1. Actual: ' + (x.length));
}
assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
//CHECK#3
x[1] = 1;
if (x.length !== 2) {
throw new Test262Error('#3: x = []; x[0] = 1; x[1] = 1; x.length === 2. Actual: ' + (x.length));
}
assert.sameValue(x.length, 2, 'The value of x.length is expected to be 2');
//CHECK#4
x[9] = 1;
if (x.length !== 10) {
throw new Test262Error('#4: x = []; x[0] = 1; x[1] = 1; x[9] = 1; x.length === 10. Actual: ' + (x.length));
}
assert.sameValue(x.length, 10, 'The value of x.length is expected to be 10');

View File

@ -14,18 +14,10 @@ description: >
//CHECK#1
var x = [];
x.length = 1;
if (x.length !== 1) {
throw new Test262Error('#1: x = []; x.length = 1; x.length === 1. Actual: ' + (x.length));
}
assert.sameValue(x.length, 1, 'The value of x.length is expected to be 1');
//CHECK#2
x[5] = 1;
x.length = 10;
if (x.length !== 10) {
throw new Test262Error('#2: x = []; x.length = 1; x[5] = 1; x.length = 10; x.length === 10. Actual: ' + (x.length));
}
//CHECK#3
if (x[5] !== 1) {
throw new Test262Error('#3: x = []; x.length = 1; x[5] = 1; x.length = 10; x[5] = 1');
}
assert.sameValue(x.length, 10, 'The value of x.length is expected to be 10');
assert.sameValue(x[5], 1, 'The value of x[5] is expected to be 1');

View File

@ -17,34 +17,18 @@ x[1] = 1;
x[3] = 3;
x[5] = 5;
x.length = 4;
if (x.length !== 4) {
throw new Test262Error('#1: x = []; x[1] = 1; x[3] = 3; x[5] = 5; x.length = 4; x.length === 4. Actual: ' + (x.length));
}
//CHECK#2
if (x[5] !== undefined) {
throw new Test262Error('#2: x = []; x[1] = 1; x[3] = 3; x[5] = 5; x.length = 4; x[5] === undefined. Actual: ' + (x[5]));
}
//CHECK#3
if (x[3] !== 3) {
throw new Test262Error('#3: x = []; x[1] = 1; x[3] = 3; x[5] = 5; x.length = 4; x[3] === 3. Actual: ' + (x[3]));
}
assert.sameValue(x.length, 4, 'The value of x.length is expected to be 4');
assert.sameValue(x[5], undefined, 'The value of x[5] is expected to equal undefined');
assert.sameValue(x[3], 3, 'The value of x[3] is expected to be 3');
//CHECK#4
x.length = new Number(6);
if (x[5] !== undefined) {
throw new Test262Error('#4: x = []; x[1] = 1; x[3] = 3; x[5] = 5; x.length = 4; x.length = new Number(6); x[5] === undefined. Actual: ' + (x[5]));
}
assert.sameValue(x[5], undefined, 'The value of x[5] is expected to equal undefined');
//CHECK#5
x.length = 0;
if (x[0] !== undefined) {
throw new Test262Error('#5: x = []; x[1] = 1; x[3] = 3; x[5] = 5; x.length = 4; x.length = new Number(6); x.length = 0; x[0] === undefined. Actual: ' + (x[0]));
}
assert.sameValue(x[0], undefined, 'The value of x[0] is expected to equal undefined');
//CHECK#6
x.length = 1;
if (x[1] !== undefined) {
throw new Test262Error('#6: x = []; x[1] = 1; x[3] = 3; x[5] = 5; x.length = 4; x.length = new Number(6); x.length = 0; x.length = 1; x[1] === undefined. Actual: ' + (x[1]));
}
assert.sameValue(x[1], undefined, 'The value of x[1] is expected to equal undefined');

View File

@ -12,9 +12,7 @@ description: "[[Put]] (length, 4294967296)"
//CHECK#1
var x = [];
x.length = 4294967295;
if (x.length !== 4294967295) {
throw new Test262Error('#1: x = []; x.length = 4294967295; x.length === 4294967295');
}
assert.sameValue(x.length, 4294967295, 'The value of x.length is expected to be 4294967295');
//CHECK#2
try {
@ -22,7 +20,9 @@ try {
x.length = 4294967296;
throw new Test262Error('#2.1: x = []; x.length = 4294967296 throw RangeError. Actual: x.length === ' + (x.length));
} catch (e) {
if ((e instanceof RangeError) !== true) {
throw new Test262Error('#2.2: x = []; x.length = 4294967296 throw RangeError. Actual: ' + (e));
}
assert.sameValue(
e instanceof RangeError,
true,
'The result of evaluating (e instanceof RangeError) is expected to be true'
);
}

View File

@ -20,7 +20,5 @@ for (var i = 0; i < 32; i++) {
k = 1;
for (i = 0; i < 32; i++) {
k = k * 2;
if (x[k - 2] !== k) {
throw new Test262Error('#' + (k - 2) + ': ');
}
assert.sameValue(x[k - 2], k, 'The value of x[k - 2] is expected to equal the value of k');
}

View File

@ -12,13 +12,9 @@ description: Checking for string primitive
//CHECK#1
var x = [];
x["0"] = 0;
if (x[0] !== 0) {
throw new Test262Error('#1: x = []; x["0"] = 0; x[0] === 0. Actual: ' + (x[0]));
}
assert.sameValue(x[0], 0, 'The value of x[0] is expected to be 0');
//CHECK#2
var y = [];
y["1"] = 1;
if (y[1] !== 1) {
throw new Test262Error('#2: y = []; y["1"] = 1; y[1] === 1. Actual: ' + (y[1]));
}
assert.sameValue(y[1], 1, 'The value of y[1] is expected to be 1');

View File

@ -12,23 +12,11 @@ description: Checking for null and undefined
//CHECK#1
var x = [];
x[null] = 0;
if (x[0] !== undefined) {
throw new Test262Error('#1: x = []; x[null] = 1; x[0] === undefined. Actual: ' + (x[0]));
}
//CHECK#2
if (x["null"] !== 0) {
throw new Test262Error('#2: x = []; x[null] = 1; x["null"] === 0. Actual: ' + (x["null"]));
}
assert.sameValue(x[0], undefined, 'The value of x[0] is expected to equal undefined');
assert.sameValue(x["null"], 0, 'The value of x["null"] is expected to be 0');
//CHECK#3
var y = [];
y[undefined] = 0;
if (y[0] !== undefined) {
throw new Test262Error('#3: y = []; y[undefined] = 0; y[0] === undefined. Actual: ' + (y[0]));
}
//CHECK#4
if (y["undefined"] !== 0) {
throw new Test262Error('#4: y = []; y[undefined] = 1; y["undefined"] === 0. Actual: ' + (y["undefined"]));
}
assert.sameValue(y[0], undefined, 'The value of y[0] is expected to equal undefined');
assert.sameValue(y["undefined"], 0, 'The value of y["undefined"] is expected to be 0');

View File

@ -12,22 +12,10 @@ description: Checking for Boolean object
//CHECK#1
var x = [];
x[new Boolean(true)] = 1;
if (x[1] !== undefined) {
throw new Test262Error('#1: x = []; x[new Boolean(true)] = 1; x[1] === undefined. Actual: ' + (x[1]));
}
//CHECK#2
if (x["true"] !== 1) {
throw new Test262Error('#2: x = []; x[true] = 1; x["true"] === 1. Actual: ' + (x["true"]));
}
assert.sameValue(x[1], undefined, 'The value of x[1] is expected to equal undefined');
assert.sameValue(x["true"], 1, 'The value of x["true"] is expected to be 1');
//CHECK#3
x[new Boolean(false)] = 0;
if (x[0] !== undefined) {
throw new Test262Error('#3: x = []; x[true] = 1; x[new Boolean(false)] = 0; x[0] === undefined. Actual: ' + (x[0]));
}
//CHECK#4
if (x["false"] !== 0) {
throw new Test262Error('#4: x = []; x[false] = 1; x["false"] === 0. Actual: ' + (x["false"]));
}
assert.sameValue(x[0], undefined, 'The value of x[0] is expected to equal undefined');
assert.sameValue(x["false"], 0, 'The value of x["false"] is expected to be 0');

View File

@ -12,20 +12,14 @@ description: Checking for Number object
//CHECK#1
var x = [];
x[new Number(0)] = 0;
if (x[0] !== 0) {
throw new Test262Error('#1: x = []; x[new Number(0)] = 0; x[0] === 0. Actual: ' + (x[0]));
}
assert.sameValue(x[0], 0, 'The value of x[0] is expected to be 0');
//CHECK#2
var y = [];
y[new Number(1)] = 1;
if (y[1] !== 1) {
throw new Test262Error('#2: y = []; y[new Number(1)] = 1; y[1] === 1. Actual: ' + (y[1]));
}
assert.sameValue(y[1], 1, 'The value of y[1] is expected to be 1');
//CHECK#3
var z = [];
z[new Number(1.1)] = 1;
if (z["1.1"] !== 1) {
throw new Test262Error('#3: z = []; z[new Number(1.1)] = 1; z["1.1"] === 1. Actual: ' + (z["1.1"]));
}
assert.sameValue(z["1.1"], 1, 'The value of z["1.1"] is expected to be 1');

View File

@ -12,20 +12,14 @@ description: Checking for Number object
//CHECK#1
var x = [];
x[new String("0")] = 0;
if (x[0] !== 0) {
throw new Test262Error('#1: x = []; x[new String("0")] = 0; x[0] === 0. Actual: ' + (x[0]));
}
assert.sameValue(x[0], 0, 'The value of x[0] is expected to be 0');
//CHECK#2
var y = [];
y[new String("1")] = 1;
if (y[1] !== 1) {
throw new Test262Error('#2: y = []; y[new String("1")] = 1; y[1] === 1. Actual: ' + (y[1]));
}
assert.sameValue(y[1], 1, 'The value of y[1] is expected to be 1');
//CHECK#3
var z = [];
z[new String("1.1")] = 1;
if (z["1.1"] !== 1) {
throw new Test262Error('#3: z = []; z[new String("1.1")] = 1; z["1.1"] === 1. Actual: ' + (z["1.1"]));
}
assert.sameValue(z["1.1"], 1, 'The value of z["1.1"] is expected to be 1');

View File

@ -17,9 +17,7 @@ var object = {
}
};
x[object] = 0;
if (x["[object Object]"] !== 0) {
throw new Test262Error('#1: x = []; var object = {valueOf: function() {return 1}}; x[object] = 0; x["[object Object]"] === 0. Actual: ' + (x["[object Object]"]));
}
assert.sameValue(x["[object Object]"], 0, 'The value of x["[object Object]"] is expected to be 0');
//CHECK#2
x = [];
@ -32,9 +30,7 @@ var object = {
}
};
x[object] = 0;
if (x[0] !== 0) {
throw new Test262Error('#2: x = []; var object = {valueOf: function() {return 1}, toString: function() {return 0}}; x[object] = 0; x[0] === 0. Actual: ' + (x[0]));
}
assert.sameValue(x[0], 0, 'The value of x[0] is expected to be 0');
//CHECK#3
x = [];
@ -47,9 +43,7 @@ var object = {
}
};
x[object] = 0;
if (x[1] !== 0) {
throw new Test262Error('#3: x = []; var object = {valueOf: function() {return 1}, toString: function() {return {}}}; x[object] = 0; x[1] === 0. Actual: ' + (x[1]));
}
assert.sameValue(x[1], 0, 'The value of x[1] is expected to be 0');
//CHECK#4
try {
@ -63,16 +57,10 @@ try {
}
};
x[object] = 0;
if (x[1] !== 0) {
throw new Test262Error('#4.1: x = []; var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; x[object] = 0; x[1] === 1. Actual: ' + (x[1]));
}
assert.sameValue(x[1], 0, 'The value of x[1] is expected to be 0');
}
catch (e) {
if (e === "error") {
throw new Test262Error('#4.2: x = []; var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; x[object] = 0; x[1] === 1. Actual: ' + ("error"));
} else {
throw new Test262Error('#4.3: x = []; var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; x[object] = 0; x[1] === 1. Actual: ' + (e));
}
assert.notSameValue(e, "error", 'The value of e is not "error"');
}
//CHECK#5
@ -83,9 +71,7 @@ var object = {
}
};
x[object] = 0;
if (x[1] !== 0) {
throw new Test262Error('#5: x = []; var object = {toString: function() {return 1}}; x[object] = 0; x[1] === 0. Actual: ' + (x[1]));
}
assert.sameValue(x[1], 0, 'The value of x[1] is expected to be 0');
//CHECK#6
x = [];
@ -98,9 +84,7 @@ var object = {
}
}
x[object] = 0;
if (x[1] !== 0) {
throw new Test262Error('#6: x = []; var object = {valueOf: function() {return {}}, toString: function() {return 1}}; x[object] = 0; x[1] === 0. Actual: ' + (x[1]));
}
assert.sameValue(x[1], 0, 'The value of x[1] is expected to be 0');
//CHECK#7
try {
@ -117,9 +101,7 @@ try {
throw new Test262Error('#7.1: x = []; var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; x[object] throw "error". Actual: ' + (x[object]));
}
catch (e) {
if (e !== "error") {
throw new Test262Error('#7.2: x = []; var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; x[object] throw "error". Actual: ' + (e));
}
assert.sameValue(e, "error", 'The value of e is expected to be "error"');
}
//CHECK#8
@ -137,7 +119,9 @@ try {
throw new Test262Error('#8.1: x = []; var object = {valueOf: function() {return {}}, toString: function() {return {}}}; x[object] throw TypeError. Actual: ' + (x[object]));
}
catch (e) {
if ((e instanceof TypeError) !== true) {
throw new Test262Error('#8.2: x = []; var object = {valueOf: function() {return {}}, toString: function() {return {}}}; x[object] throw TypeError. Actual: ' + (e));
}
assert.sameValue(
e instanceof TypeError,
true,
'The result of evaluating (e instanceof TypeError) is expected to be true'
);
}

View File

@ -7,4 +7,4 @@ description: >
The Array constructor is a built-in function
---*/
assert.sameValue(typeof Array, 'function');
assert.sameValue(typeof Array, 'function', 'The value of `typeof Array` is expected to be "function"');

View File

@ -22,7 +22,7 @@ includes: [propertyHelper.js]
assert.sameValue(
Array.from.name,
'from',
'The value of `Array.from.name` is `"from"`'
'The value of Array.from.name is expected to be "from"'
);
verifyNotEnumerable(Array.from, 'name');

View File

@ -14,7 +14,7 @@ info: |
includes: [propertyHelper.js]
---*/
assert.sameValue(Array.from.length, 1);
assert.sameValue(Array.from.length, 1, 'The value of Array.from.length is expected to be 1');
verifyNotEnumerable(Array.from, 'length');
verifyNotWritable(Array.from, 'length');

View File

@ -31,6 +31,9 @@ result = Array.from.call(MyCollection, {
length: 42
});
assert.sameValue(result.args.length, 1);
assert.sameValue(result.args[0], 42);
assert(result instanceof MyCollection);
assert.sameValue(result.args.length, 1, 'The value of result.args.length is expected to be 1');
assert.sameValue(result.args[0], 42, 'The value of result.args[0] is expected to be 42');
assert(
result instanceof MyCollection,
'The result of evaluating (result instanceof MyCollection) is expected to be true'
);

View File

@ -43,24 +43,24 @@ function mapFn(value) {
var result = Array.from(list, mapFn);
assert.sameValue(result.length, 3, 'result.length');
assert.sameValue(result[0], 82, 'result[0]');
assert.sameValue(result[1], 84, 'result[1]');
assert.sameValue(result[2], 86, 'result[2]');
assert.sameValue(result.length, 3, 'The value of result.length is expected to be 3');
assert.sameValue(result[0], 82, 'The value of result[0] is expected to be 82');
assert.sameValue(result[1], 84, 'The value of result[1] is expected to be 84');
assert.sameValue(result[2], 86, 'The value of result[2] is expected to be 86');
assert.sameValue(calls.length, 3, 'calls.length');
assert.sameValue(calls.length, 3, 'The value of calls.length is expected to be 3');
assert.sameValue(calls[0].args.length, 2, 'calls[0].args.length');
assert.sameValue(calls[0].args[0], 41, 'calls[0].args[0]');
assert.sameValue(calls[0].args[1], 0, 'calls[0].args[1]');
assert.sameValue(calls[0].thisArg, this, 'calls[0].thisArg');
assert.sameValue(calls[0].args.length, 2, 'The value of calls[0].args.length is expected to be 2');
assert.sameValue(calls[0].args[0], 41, 'The value of calls[0].args[0] is expected to be 41');
assert.sameValue(calls[0].args[1], 0, 'The value of calls[0].args[1] is expected to be 0');
assert.sameValue(calls[0].thisArg, this, 'The value of calls[0].thisArg is expected to be this');
assert.sameValue(calls[1].args.length, 2, 'calls[1].args.length');
assert.sameValue(calls[1].args[0], 42, 'calls[1].args[0]');
assert.sameValue(calls[1].args[1], 1, 'calls[1].args[1]');
assert.sameValue(calls[1].thisArg, this, 'calls[1].thisArg');
assert.sameValue(calls[1].args.length, 2, 'The value of calls[1].args.length is expected to be 2');
assert.sameValue(calls[1].args[0], 42, 'The value of calls[1].args[0] is expected to be 42');
assert.sameValue(calls[1].args[1], 1, 'The value of calls[1].args[1] is expected to be 1');
assert.sameValue(calls[1].thisArg, this, 'The value of calls[1].thisArg is expected to be this');
assert.sameValue(calls[2].args.length, 2, 'calls[2].args.length');
assert.sameValue(calls[2].args[0], 43, 'calls[2].args[0]');
assert.sameValue(calls[2].args[1], 2, 'calls[2].args[1]');
assert.sameValue(calls[2].thisArg, this, 'calls[2].thisArg');
assert.sameValue(calls[2].args.length, 2, 'The value of calls[2].args.length is expected to be 2');
assert.sameValue(calls[2].args[0], 43, 'The value of calls[2].args[0] is expected to be 43');
assert.sameValue(calls[2].args[1], 2, 'The value of calls[2].args[1] is expected to be 2');
assert.sameValue(calls[2].thisArg, this, 'The value of calls[2].thisArg is expected to be this');

View File

@ -43,24 +43,24 @@ function mapFn(value) {
var result = Array.from(list, mapFn);
assert.sameValue(result.length, 3, 'result.length');
assert.sameValue(result[0], 82, 'result[0]');
assert.sameValue(result[1], 84, 'result[1]');
assert.sameValue(result[2], 86, 'result[2]');
assert.sameValue(result.length, 3, 'The value of result.length is expected to be 3');
assert.sameValue(result[0], 82, 'The value of result[0] is expected to be 82');
assert.sameValue(result[1], 84, 'The value of result[1] is expected to be 84');
assert.sameValue(result[2], 86, 'The value of result[2] is expected to be 86');
assert.sameValue(calls.length, 3, 'calls.length');
assert.sameValue(calls.length, 3, 'The value of calls.length is expected to be 3');
assert.sameValue(calls[0].args.length, 2, 'calls[0].args.length');
assert.sameValue(calls[0].args[0], 41, 'calls[0].args[0]');
assert.sameValue(calls[0].args[1], 0, 'calls[0].args[1]');
assert.sameValue(calls[0].thisArg, undefined, 'calls[0].thisArg');
assert.sameValue(calls[0].args.length, 2, 'The value of calls[0].args.length is expected to be 2');
assert.sameValue(calls[0].args[0], 41, 'The value of calls[0].args[0] is expected to be 41');
assert.sameValue(calls[0].args[1], 0, 'The value of calls[0].args[1] is expected to be 0');
assert.sameValue(calls[0].thisArg, undefined, 'The value of calls[0].thisArg is expected to equal undefined');
assert.sameValue(calls[1].args.length, 2, 'calls[1].args.length');
assert.sameValue(calls[1].args[0], 42, 'calls[1].args[0]');
assert.sameValue(calls[1].args[1], 1, 'calls[1].args[1]');
assert.sameValue(calls[1].thisArg, undefined, 'calls[1].thisArg');
assert.sameValue(calls[1].args.length, 2, 'The value of calls[1].args.length is expected to be 2');
assert.sameValue(calls[1].args[0], 42, 'The value of calls[1].args[0] is expected to be 42');
assert.sameValue(calls[1].args[1], 1, 'The value of calls[1].args[1] is expected to be 1');
assert.sameValue(calls[1].thisArg, undefined, 'The value of calls[1].thisArg is expected to equal undefined');
assert.sameValue(calls[2].args.length, 2, 'calls[2].args.length');
assert.sameValue(calls[2].args[0], 43, 'calls[2].args[0]');
assert.sameValue(calls[2].args[1], 2, 'calls[2].args[1]');
assert.sameValue(calls[2].thisArg, undefined, 'calls[2].thisArg');
assert.sameValue(calls[2].args.length, 2, 'The value of calls[2].args.length is expected to be 2');
assert.sameValue(calls[2].args[0], 43, 'The value of calls[2].args[0] is expected to be 43');
assert.sameValue(calls[2].args[1], 2, 'The value of calls[2].args[1] is expected to be 2');
assert.sameValue(calls[2].thisArg, undefined, 'The value of calls[2].thisArg is expected to equal undefined');

View File

@ -44,24 +44,24 @@ function mapFn(value) {
var result = Array.from(list, mapFn, thisArg);
assert.sameValue(result.length, 3, 'result.length');
assert.sameValue(result[0], 82, 'result[0]');
assert.sameValue(result[1], 84, 'result[1]');
assert.sameValue(result[2], 86, 'result[2]');
assert.sameValue(result.length, 3, 'The value of result.length is expected to be 3');
assert.sameValue(result[0], 82, 'The value of result[0] is expected to be 82');
assert.sameValue(result[1], 84, 'The value of result[1] is expected to be 84');
assert.sameValue(result[2], 86, 'The value of result[2] is expected to be 86');
assert.sameValue(calls.length, 3, 'calls.length');
assert.sameValue(calls.length, 3, 'The value of calls.length is expected to be 3');
assert.sameValue(calls[0].args.length, 2, 'calls[0].args.length');
assert.sameValue(calls[0].args[0], 41, 'calls[0].args[0]');
assert.sameValue(calls[0].args[1], 0, 'calls[0].args[1]');
assert.sameValue(calls[0].thisArg, thisArg, 'calls[0].thisArg');
assert.sameValue(calls[0].args.length, 2, 'The value of calls[0].args.length is expected to be 2');
assert.sameValue(calls[0].args[0], 41, 'The value of calls[0].args[0] is expected to be 41');
assert.sameValue(calls[0].args[1], 0, 'The value of calls[0].args[1] is expected to be 0');
assert.sameValue(calls[0].thisArg, thisArg, 'The value of calls[0].thisArg is expected to equal the value of thisArg');
assert.sameValue(calls[1].args.length, 2, 'calls[1].args.length');
assert.sameValue(calls[1].args[0], 42, 'calls[1].args[0]');
assert.sameValue(calls[1].args[1], 1, 'calls[1].args[1]');
assert.sameValue(calls[1].thisArg, thisArg, 'calls[1].thisArg');
assert.sameValue(calls[1].args.length, 2, 'The value of calls[1].args.length is expected to be 2');
assert.sameValue(calls[1].args[0], 42, 'The value of calls[1].args[0] is expected to be 42');
assert.sameValue(calls[1].args[1], 1, 'The value of calls[1].args[1] is expected to be 1');
assert.sameValue(calls[1].thisArg, thisArg, 'The value of calls[1].thisArg is expected to equal the value of thisArg');
assert.sameValue(calls[2].args.length, 2, 'calls[2].args.length');
assert.sameValue(calls[2].args[0], 43, 'calls[2].args[0]');
assert.sameValue(calls[2].args[1], 2, 'calls[2].args[1]');
assert.sameValue(calls[2].thisArg, thisArg, 'calls[2].thisArg');
assert.sameValue(calls[2].args.length, 2, 'The value of calls[2].args.length is expected to be 2');
assert.sameValue(calls[2].args[0], 43, 'The value of calls[2].args[0] is expected to be 43');
assert.sameValue(calls[2].args[1], 2, 'The value of calls[2].args[1] is expected to be 2');
assert.sameValue(calls[2].thisArg, thisArg, 'The value of calls[2].thisArg is expected to equal the value of thisArg');

View File

@ -22,8 +22,8 @@ var array = [2, 4, 8, 16, 32, 64, 128];
function mapFn(value, index) {
arrayIndex++;
assert.sameValue(value, obj[arrayIndex], "Value mismatch in mapFn at index " + index + ".");
assert.sameValue(index, arrayIndex, "Index mismatch in mapFn.");
assert.sameValue(value, obj[arrayIndex], 'The value of value is expected to equal the value of obj[arrayIndex]');
assert.sameValue(index, arrayIndex, 'The value of index is expected to equal the value of arrayIndex');
obj[originalLength + arrayIndex] = 2 * arrayIndex + 1;
return obj[arrayIndex];
@ -31,8 +31,8 @@ function mapFn(value, index) {
var a = Array.from(obj, mapFn);
assert.sameValue(a.length, array.length, "Length mismatch.");
assert.sameValue(a.length, array.length, 'The value of a.length is expected to equal the value of array.length');
for (var j = 0; j < a.length; j++) {
assert.sameValue(a[j], array[j], "Element mismatch for array at index " + j + ".");
assert.sameValue(a[j], array[j], 'The value of a[j] is expected to equal the value of array[j]');
}

View File

@ -15,8 +15,8 @@ var arrayIndex = -1;
function mapFn(value, index) {
this.arrayIndex++;
assert.sameValue(value, array[this.arrayIndex], "Value mismatch in mapFn at index " + index + ".");
assert.sameValue(index, this.arrayIndex, "Index mismatch in mapFn.");
assert.sameValue(value, array[this.arrayIndex], 'The value of value is expected to equal the value of array[this.arrayIndex]');
assert.sameValue(index, this.arrayIndex, 'The value of index is expected to equal the value of this.arrayIndex');
array.splice(array.length - 1, 1);
return 127;
@ -25,8 +25,8 @@ function mapFn(value, index) {
a = Array.from(array, mapFn, this);
assert.sameValue(a.length, originalArray.length / 2, "Length mismatch. Old array : " + (originalArray.length / 2) + ". array : " + a.length + ".");
assert.sameValue(a.length, originalArray.length / 2, 'The value of a.length is expected to be originalArray.length / 2');
for (var j = 0; j < originalArray.length / 2; j++) {
assert.sameValue(a[j], 127, "Element mismatch for mapped array at index " + j + ".");
assert.sameValue(a[j], 127, 'The value of a[j] is expected to be 127');
}

View File

@ -14,14 +14,14 @@ function mapFn(value, index) {
if (index + 1 < array.length) {
array[index + 1] = 127;
}
assert.sameValue(value, 127, "Value mismatch in mapFn at index " + index + ".");
assert.sameValue(index, arrayIndex, "Index mismatch in mapFn.");
assert.sameValue(value, 127, 'The value of value is expected to be 127');
assert.sameValue(index, arrayIndex, 'The value of index is expected to equal the value of arrayIndex');
return value;
}
var a = Array.from(array, mapFn);
assert.sameValue(a.length, array.length, "Length mismatch.");
assert.sameValue(a.length, array.length, 'The value of a.length is expected to equal the value of array.length');
for (var j = 0; j < a.length; j++) {
assert.sameValue(a[j], 127, "Element mismatch for mapped array.");
assert.sameValue(a[j], 127, 'The value of a[j] is expected to be 127');
}

View File

@ -9,15 +9,15 @@ esid: sec-array.from
var array = [0, 'foo', , Infinity];
var result = Array.from(array);
assert.sameValue(result.length, 4, 'result.length');
assert.sameValue(result[0], 0, 'result[0]');
assert.sameValue(result[1], 'foo', 'result[1]');
assert.sameValue(result[2], undefined, 'result[2]');
assert.sameValue(result[3], Infinity, 'result[3]');
assert.sameValue(result.length, 4, 'The value of result.length is expected to be 4');
assert.sameValue(result[0], 0, 'The value of result[0] is expected to be 0');
assert.sameValue(result[1], 'foo', 'The value of result[1] is expected to be "foo"');
assert.sameValue(result[2], undefined, 'The value of result[2] is expected to equal undefined');
assert.sameValue(result[3], Infinity, 'The value of result[3] is expected to equal Infinity');
assert.notSameValue(
result, array,
'result is not the object from items argument'
'The value of result is expected to not equal the value of `array`'
);
assert(result instanceof Array, 'result instanceof Array');
assert(result instanceof Array, 'The result of evaluating (result instanceof Array) is expected to be true');

View File

@ -10,8 +10,8 @@ author: Hank Yates (hankyates@gmail.com)
var arrLikeSource = 'Test';
var result = Array.from(arrLikeSource);
assert.sameValue(result.length, 4, 'result.length');
assert.sameValue(result[0], 'T', 'result[0]');
assert.sameValue(result[1], 'e', 'result[1]');
assert.sameValue(result[2], 's', 'result[2]');
assert.sameValue(result[3], 't', 'result[3]');
assert.sameValue(result.length, 4, 'The value of result.length is expected to be 4');
assert.sameValue(result[0], 'T', 'The value of result[0] is expected to be "T"');
assert.sameValue(result[1], 'e', 'The value of result[1] is expected to be "e"');
assert.sameValue(result[2], 's', 'The value of result[2] is expected to be "s"');
assert.sameValue(result[3], 't', 'The value of result[3] is expected to be "t"');

View File

@ -19,4 +19,4 @@ Object.defineProperty(items, Symbol.iterator, {
assert.throws(Test262Error, function() {
Array.from(items);
});
}, 'Array.from(items) throws a Test262Error exception');

View File

@ -16,4 +16,4 @@ var arrayBuffer = new ArrayBuffer(7);
var result = Array.from(arrayBuffer);
assert.sameValue(result.length, 0);
assert.sameValue(result.length, 0, 'The value of result.length is expected to be 0');

View File

@ -14,4 +14,4 @@ info: |
assert.throws(TypeError, function() {
Array.from(null);
});
}, 'Array.from(null) throws a TypeError exception');

View File

@ -25,4 +25,4 @@ items[Symbol.iterator] = function() {
assert.throws(Test262Error, function() {
Array.from(items);
});
}, 'Array.from(items) throws a Test262Error exception');

View File

@ -23,4 +23,4 @@ items[Symbol.iterator] = function() {};
assert.throws(Test262Error, function() {
Array.from.call(C, items);
});
}, 'Array.from.call(C, items) throws a Test262Error exception');

View File

@ -36,13 +36,13 @@ items[Symbol.iterator] = function() {
result = Array.from.call(C, items);
assert(
result instanceof C, 'Constructed value is an instance of the constructor'
result instanceof C, 'The result of evaluating (result instanceof C) is expected to be true'
);
assert.sameValue(
result.constructor,
C,
'Constructed value correctly defines a `constructor` property'
'The value of result.constructor is expected to equal the value of C'
);
assert.sameValue(callCount, 1, 'Constructor invoked exactly once');
assert.sameValue(thisVal, result, 'Constructed value is returned');
assert.sameValue(args.length, 0, 'Constructor invoked without arguments');
assert.sameValue(callCount, 1, 'The value of callCount is expected to be 1');
assert.sameValue(thisVal, result, 'The value of thisVal is expected to equal the value of result');
assert.sameValue(args.length, 0, 'The value of args.length is expected to be 0');

View File

@ -12,11 +12,11 @@ info: |
features: [Symbol.iterator]
---*/
var items = {};
items[Symbol.iterator] = function() {
var itemsPoisonedSymbolIterator = {};
itemsPoisonedSymbolIterator[Symbol.iterator] = function() {
throw new Test262Error();
};
assert.throws(Test262Error, function() {
Array.from(items);
});
Array.from(itemsPoisonedSymbolIterator);
}, 'Array.from(itemsPoisonedSymbolIterator) throws a Test262Error exception');

View File

@ -14,14 +14,14 @@ info: |
features: [Symbol.iterator]
---*/
var items = {};
var itemsPoisonedIteratorValue = {};
var poisonedValue = {};
Object.defineProperty(poisonedValue, 'value', {
get: function() {
throw new Test262Error();
}
});
items[Symbol.iterator] = function() {
itemsPoisonedIteratorValue[Symbol.iterator] = function() {
return {
next: function() {
return poisonedValue;
@ -30,5 +30,5 @@ items[Symbol.iterator] = function() {
};
assert.throws(Test262Error, function() {
Array.from(items);
});
Array.from(itemsPoisonedIteratorValue);
}, 'Array.from(itemsPoisonedIteratorValue) throws a Test262Error exception');

View File

@ -56,16 +56,16 @@ items[Symbol.iterator] = function() {
Array.from(items, mapFn);
assert.sameValue(args.length, 2, 'Iteration count');
assert.sameValue(args.length, 2, 'The value of args.length is expected to be 2');
assert.sameValue(args[0].length, 2, 'First iteration: arguments length');
assert.sameValue(args[0].length, 2, 'The value of args[0].length is expected to be 2');
assert.sameValue(
args[0][0], firstResult.value, 'First iteration: first argument'
args[0][0], firstResult.value, 'The value of args[0][0] is expected to equal the value of firstResult.value'
);
assert.sameValue(args[0][1], 0, 'First iteration: second argument');
assert.sameValue(args[0][1], 0, 'The value of args[0][1] is expected to be 0');
assert.sameValue(args[1].length, 2, 'Second iteration: arguments length');
assert.sameValue(args[1].length, 2, 'The value of args[1].length is expected to be 2');
assert.sameValue(
args[1][0], secondResult.value, 'Second iteration: first argument'
args[1][0], secondResult.value, 'The value of args[1][0] is expected to equal the value of secondResult.value'
);
assert.sameValue(args[1][1], 1, 'Second iteration: second argument');
assert.sameValue(args[1][1], 1, 'The value of args[1][1] is expected to be 1');

View File

@ -36,6 +36,6 @@ items[Symbol.iterator] = function() {
assert.throws(Test262Error, function() {
Array.from(items, mapFn);
});
}, 'Array.from(items, mapFn) throws a Test262Error exception');
assert.sameValue(closeCount, 1);
assert.sameValue(closeCount, 1, 'The value of closeCount is expected to be 1');

View File

@ -61,6 +61,10 @@ items[Symbol.iterator] = function() {
result = Array.from(items, mapFn);
assert.sameValue(result.length, 2);
assert.sameValue(result[0], firstReturnVal);
assert.sameValue(result[1], secondReturnVal);
assert.sameValue(result.length, 2, 'The value of result.length is expected to be 2');
assert.sameValue(result[0], firstReturnVal, 'The value of result[0] is expected to equal the value of firstReturnVal');
assert.sameValue(
result[1],
secondReturnVal,
'The value of result[1] is expected to equal the value of secondReturnVal'
);

View File

@ -52,6 +52,6 @@ items[Symbol.iterator] = function() {
Array.from(items, mapFn, thisVal);
assert.sameValue(thisVals.length, 2);
assert.sameValue(thisVals[0], thisVal, 'First iteration `this` value');
assert.sameValue(thisVals[1], thisVal, 'Second iteration `this` value');
assert.sameValue(thisVals.length, 2, 'The value of thisVals.length is expected to be 2');
assert.sameValue(thisVals[0], thisVal, 'The value of thisVals[0] is expected to equal the value of thisVal');
assert.sameValue(thisVals[1], thisVal, 'The value of thisVals[1] is expected to equal the value of thisVal');

View File

@ -55,6 +55,6 @@ items[Symbol.iterator] = function() {
Array.from(items, mapFn);
assert.sameValue(thisVals.length, 2);
assert.sameValue(thisVals[0], global, 'First iteration `this` value');
assert.sameValue(thisVals[1], global, 'Second iteration `this` value');
assert.sameValue(thisVals.length, 2, 'The value of thisVals.length is expected to be 2');
assert.sameValue(thisVals[0], global, 'The value of thisVals[0] is expected to equal the value of global');
assert.sameValue(thisVals[1], global, 'The value of thisVals[1] is expected to equal the value of global');

View File

@ -52,6 +52,6 @@ items[Symbol.iterator] = function() {
Array.from(items, mapFn);
assert.sameValue(thisVals.length, 2);
assert.sameValue(thisVals[0], undefined, 'First iteration `this` value');
assert.sameValue(thisVals[1], undefined, 'Second iteration `this` value');
assert.sameValue(thisVals.length, 2, 'The value of thisVals.length is expected to be 2');
assert.sameValue(thisVals[0], undefined, 'The value of thisVals[0] is expected to equal undefined');
assert.sameValue(thisVals[1], undefined, 'The value of thisVals[1] is expected to equal undefined');

View File

@ -16,7 +16,7 @@ info: |
features: [Symbol.iterator]
---*/
var C = function() {
var constructorSetsIndex0ConfigurableFalse = function() {
Object.defineProperty(this, '0', {
writable: true,
configurable: false
@ -46,7 +46,7 @@ items[Symbol.iterator] = function() {
};
assert.throws(TypeError, function() {
Array.from.call(C, items);
});
Array.from.call(constructorSetsIndex0ConfigurableFalse, items);
}, 'Array.from.call(constructorSetsIndex0ConfigurableFalse, items) throws a TypeError exception');
assert.sameValue(closeCount, 1);
assert.sameValue(closeCount, 1, 'The value of closeCount is expected to be 1');

View File

@ -46,5 +46,13 @@ items[Symbol.iterator] = function() {
result = Array.from(items);
assert.sameValue(result[0], firstIterResult.value);
assert.sameValue(result[1], secondIterResult.value);
assert.sameValue(
result[0],
firstIterResult.value,
'The value of result[0] is expected to equal the value of firstIterResult.value'
);
assert.sameValue(
result[1],
secondIterResult.value,
'The value of result[1] is expected to equal the value of secondIterResult.value'
);

View File

@ -15,9 +15,9 @@ info: |
features: [Symbol.iterator]
---*/
var C = function() {};
var poisonedPrototypeLength = function() {};
var items = {};
Object.defineProperty(C.prototype, 'length', {
Object.defineProperty(poisonedPrototypeLength.prototype, 'length', {
set: function(_) {
throw new Test262Error();
}
@ -33,5 +33,5 @@ items[Symbol.iterator] = function() {
};
assert.throws(Test262Error, function() {
Array.from.call(C, items);
});
Array.from.call(poisonedPrototypeLength, items);
}, 'Array.from.call(poisonedPrototypeLength, items) throws a Test262Error exception');

View File

@ -33,7 +33,7 @@ nextIterResult = lastIterResult = {
};
result = Array.from(items);
assert.sameValue(result.length, 0);
assert.sameValue(result.length, 0, 'The value of result.length is expected to be 0');
nextIterResult = {
done: false
@ -43,4 +43,4 @@ lastIterResult = {
};
result = Array.from(items);
assert.sameValue(result.length, 1);
assert.sameValue(result.length, 1, 'The value of result.length is expected to be 1');

View File

@ -15,20 +15,20 @@ info: |
assert.throws(TypeError, function() {
Array.from([], null);
});
}, 'Array.from([], null) throws a TypeError exception');
assert.throws(TypeError, function() {
Array.from([], {});
});
}, 'Array.from([], {}) throws a TypeError exception');
assert.throws(TypeError, function() {
Array.from([], 'string');
});
}, 'Array.from([], "string") throws a TypeError exception');
assert.throws(TypeError, function() {
Array.from([], true);
});
}, 'Array.from([], true) throws a TypeError exception');
assert.throws(TypeError, function() {
Array.from([], 42);
});
}, 'Array.from([], 42) throws a TypeError exception');

View File

@ -17,4 +17,4 @@ features:
assert.throws(TypeError, function() {
Array.from([], Symbol('1'));
});
}, 'Array.from([], Symbol("1")) throws a TypeError exception');

View File

@ -9,10 +9,10 @@ es6id: 22.1.2.1
var array = [2, 4, 8, 16, 32, 64, 128];
function mapFn(value, index, obj) {
function mapFnThrows(value, index, obj) {
throw new Test262Error();
}
assert.throws(Test262Error, function() {
Array.from(array, mapFn);
});
Array.from(array, mapFnThrows);
}, 'Array.from(array, mapFnThrows) throws a Test262Error exception');

View File

@ -25,5 +25,5 @@ assert.sameValue(isConstructor(Array.from), false, 'isConstructor(Array.from) mu
assert.throws(TypeError, () => {
new Array.from([]);
}, '`new Array.from([])` throws TypeError');
}, 'new Array.from([]) throws a TypeError exception');

View File

@ -28,4 +28,8 @@ C.prototype = null;
var a = Array.from.call(C, []);
assert.sameValue(Object.getPrototypeOf(a), other.Object.prototype);
assert.sameValue(
Object.getPrototypeOf(a),
other.Object.prototype,
'Object.getPrototypeOf(Array.from.call(C, [])) returns other.Object.prototype'
);

View File

@ -12,17 +12,17 @@ var arrayIndex = -1;
function mapFn(value, index) {
this.arrayIndex++;
assert.sameValue(value, array[this.arrayIndex], "Value mismatch in mapFn at index " + index + ".");
assert.sameValue(index, this.arrayIndex, "Index mismatch in mapFn.");
assert.sameValue(value, array[this.arrayIndex], 'The value of value is expected to equal the value of array[this.arrayIndex]');
assert.sameValue(index, this.arrayIndex, 'The value of index is expected to equal the value of this.arrayIndex');
return value;
}
var a = Array.from(array, mapFn, this);
assert.sameValue(a.length, array.length, "Length mismatch.");
assert.sameValue(a[0], Number.MAX_VALUE, "Element mismatch for mapped array at index 0.");
assert.sameValue(a[1], Number.MIN_VALUE, "Element mismatch for mapped array at index 1.");
assert.sameValue(a[2], Number.NaN, "Element mismatch for mapped array at index 2.");
assert.sameValue(a[3], Number.NEGATIVE_INFINITY, "Element mismatch for mapped array at index 3.");
assert.sameValue(a[4], Number.POSITIVE_INFINITY, "Element mismatch for mapped array at index 4.");
assert.sameValue(a.length, array.length, 'The value of a.length is expected to equal the value of array.length');
assert.sameValue(a[0], Number.MAX_VALUE, 'The value of a[0] is expected to equal the value of Number.MAX_VALUE');
assert.sameValue(a[1], Number.MIN_VALUE, 'The value of a[1] is expected to equal the value of Number.MIN_VALUE');
assert.sameValue(a[2], Number.NaN, 'The value of a[2] is expected to equal the value of Number.NaN');
assert.sameValue(a[3], Number.NEGATIVE_INFINITY, 'The value of a[3] is expected to equal the value of Number.NEGATIVE_INFINITY');
assert.sameValue(a[4], Number.POSITIVE_INFINITY, 'The value of a[4] is expected to equal the value of Number.POSITIVE_INFINITY');

View File

@ -8,4 +8,8 @@ esid: sec-array.from
es6id: 22.1.2.1
---*/
assert.sameValue(Array.from.call(Object, []).constructor, Object);
assert.sameValue(
Array.from.call(Object, []).constructor,
Object,
'The value of Array.from.call(Object, []).constructor is expected to equal the value of Object'
);

View File

@ -29,4 +29,4 @@ var obj = {
};
assert.throws(Test262Error, function() {
Array.from(obj);
});
}, 'Array.from(obj) throws a Test262Error exception');

View File

@ -31,7 +31,7 @@ var obj = {
}
};
var a = Array.from.call(Object, obj);
assert.sameValue(typeof a, typeof {}, "The returned type is expected to be object.");
assert.sameValue(typeof a, typeof {}, 'The value of `typeof a` is expected to be typeof {}');
for (var j = 0; j < a.length; j++) {
assert.sameValue(a[j], array[j], "Elements mismatch at " + j + ".");
assert.sameValue(a[j], array[j], 'The value of a[j] is expected to equal the value of array[j]');
}

View File

@ -38,7 +38,7 @@ var A1 = function(_length) {
assert.throws(TypeError, function() {
Array.from.call(A1, items);
});
}, 'Array.from.call(A1, items) throws a TypeError exception');
var A2 = function(_length) {
Object.defineProperty(this, "0", {
@ -49,4 +49,4 @@ var A2 = function(_length) {
assert.throws(TypeError, function() {
Array.from.call(A2, items);
});
}, 'Array.from.call(A2, items) throws a TypeError exception');

View File

@ -21,5 +21,5 @@ var obj = {
delete obj[2];
var a = Array.from(obj);
for (var j = 0; j < expectedArray.length; j++) {
assert.sameValue(a[j], expectedArray[j], "Elements mismatch at " + j + ".");
assert.sameValue(a[j], expectedArray[j], 'The value of a[j] is expected to equal the value of expectedArray[j]');
}

View File

@ -16,7 +16,7 @@ var obj = {
};
var a = Array.from.call(Object, obj);
assert.sameValue(typeof a, "object", "The returned type is expected to be object.");
assert.sameValue(typeof a, "object", 'The value of `typeof a` is expected to be "object"');
for (var j = 0; j < a.length; j++) {
assert.sameValue(a[j], array[j], "Elements mismatch at " + j + ".");
assert.sameValue(a[j], array[j], 'The value of a[j] is expected to equal the value of array[j]');
}

View File

@ -15,4 +15,4 @@ var obj = {
}
var a = Array.from(obj);
assert.sameValue(a.length, 0, "Expected an array of length 0.");
assert.sameValue(a.length, 0, 'The value of a.length is expected to be 0');

View File

@ -8,5 +8,5 @@ description: Does not throw if this is null
var result = Array.from.call(null, []);
assert(result instanceof Array, 'Does not throw if this is null');
assert.sameValue(result.length, 0, 'result.length');
assert(result instanceof Array, 'The result of evaluating (result instanceof Array) is expected to be true');
assert.sameValue(result.length, 0, 'The value of result.length is expected to be 0');

View File

@ -9,4 +9,4 @@ description: Array.isArray must exist as a function
var f = Array.isArray;
assert.sameValue(typeof(f), "function", 'typeof(f)');
assert.sameValue(typeof f, "function", 'The value of `typeof f` is expected to be "function"');

View File

@ -7,4 +7,4 @@ es5id: 15.4.3.2-0-2
description: Array.isArray must exist as a function taking 1 parameter
---*/
assert.sameValue(Array.isArray.length, 1, 'Array.isArray.length');
assert.sameValue(Array.isArray.length, 1, 'The value of Array.isArray.length is expected to be 1');

View File

@ -7,7 +7,4 @@ es5id: 15.4.3.2-0-3
description: Array.isArray return true if its argument is an Array
---*/
var a = [];
var b = Array.isArray(a);
assert.sameValue(b, true, 'b');
assert.sameValue(Array.isArray([]), true, 'Array.isArray([]) must return true');

View File

@ -6,17 +6,9 @@ esid: sec-array.isarray
description: Array.isArray return false if its argument is not an Array
---*/
var b_num = Array.isArray(42);
var b_undef = Array.isArray(undefined);
var b_bool = Array.isArray(true);
var b_str = Array.isArray("abc");
var b_obj = Array.isArray({});
var b_null = Array.isArray(null);
assert.sameValue(b_num, false, 'b_num');
assert.sameValue(b_undef, false, 'b_undef');
assert.sameValue(b_bool, false, 'b_bool');
assert.sameValue(b_str, false, 'b_str');
assert.sameValue(b_obj, false, 'b_obj');
assert.sameValue(b_null, false, 'b_null');
assert.sameValue(Array.isArray(42), false, 'Array.isArray(42) must return false');
assert.sameValue(Array.isArray(undefined), false, 'Array.isArray(undefined) must return false');
assert.sameValue(Array.isArray(true), false, 'Array.isArray(true) must return false');
assert.sameValue(Array.isArray("abc"), false, 'Array.isArray("abc") must return false');
assert.sameValue(Array.isArray({}), false, 'Array.isArray({}) must return false');
assert.sameValue(Array.isArray(null), false, 'Array.isArray(null) must return false');

View File

@ -9,6 +9,4 @@ description: >
(Array.prototype)
---*/
var b = Array.isArray(Array.prototype);
assert.sameValue(b, true, 'b');
assert.sameValue(Array.isArray(Array.prototype), true, 'Array.isArray(Array.prototype) must return true');

View File

@ -7,7 +7,4 @@ es5id: 15.4.3.2-0-6
description: Array.isArray return true if its argument is an Array (new Array())
---*/
var a = new Array(10);
var b = Array.isArray(a);
assert.sameValue(b, true, 'b');
assert.sameValue(Array.isArray(new Array(10)), true, 'Array.isArray(new Array(10)) must return true');

View File

@ -7,8 +7,4 @@ es5id: 15.4.3.2-0-7
description: Array.isArray returns false if its argument is not an Array
---*/
var o = new Object();
o[12] = 13;
var b = Array.isArray(o);
assert.sameValue(b, false, 'b');
assert.sameValue(Array.isArray({}), false, 'Array.isArray({}) must return false');

View File

@ -7,4 +7,4 @@ es5id: 15.4.3.2-1-1
description: Array.isArray applied to boolean primitive
---*/
assert.sameValue(Array.isArray(true), false, 'Array.isArray(true)');
assert.sameValue(Array.isArray(true), false, 'Array.isArray(true) must return false');

View File

@ -7,4 +7,4 @@ es5id: 15.4.3.2-1-10
description: Array.isArray applied to RegExp object
---*/
assert.sameValue(Array.isArray(new RegExp()), false, 'Array.isArray(new RegExp())');
assert.sameValue(Array.isArray(new RegExp()), false, 'Array.isArray(new RegExp()) must return false');

View File

@ -7,4 +7,4 @@ es5id: 15.4.3.2-1-11
description: Array.isArray applied to the JSON object
---*/
assert.sameValue(Array.isArray(JSON), false, 'Array.isArray(JSON)');
assert.sameValue(Array.isArray(JSON), false, 'Array.isArray(JSON) must return false');

View File

@ -7,4 +7,4 @@ es5id: 15.4.3.2-1-12
description: Array.isArray applied to Error object
---*/
assert.sameValue(Array.isArray(new SyntaxError()), false, 'Array.isArray(new SyntaxError())');
assert.sameValue(Array.isArray(new SyntaxError()), false, 'Array.isArray(new SyntaxError()) must return false');

View File

@ -13,4 +13,4 @@ var arg;
arg = arguments;
}(1, 2, 3));
assert.sameValue(Array.isArray(arg), false, 'Array.isArray(arg)');
assert.sameValue(Array.isArray(arg), false, 'Array.isArray(arguments) must return false');

View File

@ -7,4 +7,4 @@ es5id: 15.4.3.2-1-15
description: Array.isArray applied to the global object
---*/
assert.sameValue(Array.isArray(this), false, 'Array.isArray(this)');
assert.sameValue(Array.isArray(this), false, 'Array.isArray(this) must return false');

View File

@ -7,4 +7,4 @@ es5id: 15.4.3.2-1-2
description: Array.isArray applied to Boolean Object
---*/
assert.sameValue(Array.isArray(new Boolean(false)), false, 'Array.isArray(new Boolean(false))');
assert.sameValue(Array.isArray(new Boolean(false)), false, 'Array.isArray(new Boolean(false)) must return false');

View File

@ -7,4 +7,4 @@ es5id: 15.4.3.2-1-3
description: Array.isArray applied to number primitive
---*/
assert.sameValue(Array.isArray(5), false, 'Array.isArray(5)');
assert.sameValue(Array.isArray(5), false, 'Array.isArray(5) must return false');

View File

@ -7,4 +7,4 @@ es5id: 15.4.3.2-1-4
description: Array.isArray applied to Number object
---*/
assert.sameValue(Array.isArray(new Number(-3)), false, 'Array.isArray(new Number(-3))');
assert.sameValue(Array.isArray(new Number(-3)), false, 'Array.isArray(new Number(-3)) must return false');

View File

@ -7,4 +7,4 @@ es5id: 15.4.3.2-1-5
description: Array.isArray applied to string primitive
---*/
assert.sameValue(Array.isArray("abc"), false, 'Array.isArray("abc")');
assert.sameValue(Array.isArray("abc"), false, 'Array.isArray("abc") must return false');

View File

@ -7,4 +7,4 @@ es5id: 15.4.3.2-1-6
description: Array.isArray applied to String object
---*/
assert.sameValue(Array.isArray(new String("hello\nworld\\!")), false, 'Array.isArray(new String("hello\nworld\\!"))');
assert.sameValue(Array.isArray(new String("hello\nworld\\!")), false, 'Array.isArray(new String("hello\\nworld\\\\!")) must return false');

Some files were not shown because too many files have changed in this diff Show More