built-ins/Array/*: make all indentation consistent (depth & character) (#1415)

This commit is contained in:
Rick Waldron 2018-02-15 17:40:02 -05:00 committed by Leo Balter
parent 0bf08dff3d
commit afa24856b4
2146 changed files with 21758 additions and 18321 deletions

View File

@ -6,7 +6,7 @@ es5id: 15.4.5-1
description: Array instances have [[Class]] set to 'Array' description: Array instances have [[Class]] set to 'Array'
---*/ ---*/
var a = []; var a = [];
var s = Object.prototype.toString.call(a); var s = Object.prototype.toString.call(a);
assert.sameValue(s, '[object Array]', 's'); assert.sameValue(s, '[object Array]', 's');

View File

@ -8,7 +8,7 @@ description: >
element) element)
---*/ ---*/
var a =[]; var a = [];
a[4294967295] = "not an array element" ; a[4294967295] = "not an array element";
assert.sameValue(a[4294967295], "not an array element", 'a[4294967295]'); assert.sameValue(a[4294967295], "not an array element", 'a[4294967295]');

View File

@ -8,7 +8,7 @@ description: >
length of the array length of the array
---*/ ---*/
var a =[0,1,2]; var a = [0, 1, 2];
a[4294967295] = "not an array element" ; a[4294967295] = "not an array element";
assert.sameValue(a.length, 3, 'a.length'); assert.sameValue(a.length, 3, 'a.length');

View File

@ -19,7 +19,7 @@ if (x.toString() !== "[object " + "Array" + "]") {
//CHECK#2 //CHECK#2
Array.prototype.toString = Object.prototype.toString; Array.prototype.toString = Object.prototype.toString;
var x = Array(0,1,2); var x = Array(0, 1, 2);
if (x.toString() !== "[object " + "Array" + "]") { if (x.toString() !== "[object " + "Array" + "]") {
$ERROR('#2: Array.prototype.toString = Object.prototype.toString; var x = Array(0,1,2); x.toString() === "[object " + "Array" + "]". Actual: ' + (x.toString())); $ERROR('#2: Array.prototype.toString = Object.prototype.toString; var x = Array(0,1,2); x.toString() === "[object " + "Array" + "]". Actual: ' + (x.toString()));
} }

View File

@ -15,7 +15,7 @@ if (x.getClass() !== "[object " + "Array" + "]") {
} }
//CHECK#2 //CHECK#2
var x = Array(0,1,2); var x = Array(0, 1, 2);
x.getClass = Object.prototype.toString; x.getClass = Object.prototype.toString;
if (x.getClass() !== "[object " + "Array" + "]") { if (x.getClass() !== "[object " + "Array" + "]") {
$ERROR('#2: var x = Array(0,1,2); x.getClass = Object.prototype.toString; x is Array object. Actual: ' + (x.getClass())); $ERROR('#2: var x = Array(0,1,2); x.getClass = Object.prototype.toString; x is Array object. Actual: ' + (x.getClass()));

View File

@ -15,8 +15,8 @@ if (Array().length !== 0) {
} }
//CHECK#2 //CHECK#2
if (Array(0,1,0,1).length !== 4) { if (Array(0, 1, 0, 1).length !== 4) {
$ERROR('#2: (Array(0,1,0,1).length === 4. Actual: ' + (Array(0,1,0,1).length)); $ERROR('#2: (Array(0,1,0,1).length === 4. Actual: ' + (Array(0, 1, 0, 1).length));
} }
//CHECK#3 //CHECK#3

View File

@ -14,16 +14,16 @@ description: Checking correct work this algorithm
//CHECK# //CHECK#
var x = Array( var x = Array(
0,1,2,3,4,5,6,7,8,9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10,11,12,13,14,15,16,17,18,19, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20,21,22,23,24,25,26,27,28,29, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30,31,32,33,34,35,36,37,38,39, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40,41,42,43,44,45,46,47,48,49, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50,51,52,53,54,55,56,57,58,59, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60,61,62,63,64,65,66,67,68,69, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
70,71,72,73,74,75,76,77,78,79, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80,81,82,83,84,85,86,87,88,89, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
90,91,92,93,94,95,96,97,98,99 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
); );
for (var i = 0; i < 100; i++) { for (var i = 0; i < 100; i++) {

View File

@ -19,7 +19,7 @@ if (x.toString() !== "[object " + "Array" + "]") {
//CHECK#2 //CHECK#2
Array.prototype.toString = Object.prototype.toString; Array.prototype.toString = Object.prototype.toString;
var x = new Array(0,1,2); var x = new Array(0, 1, 2);
if (x.toString() !== "[object " + "Array" + "]") { if (x.toString() !== "[object " + "Array" + "]") {
$ERROR('#2: Array.prototype.toString = Object.prototype.toString; var x = new Array(0,1,2); x.toString() === "[object " + "Array" + "]". Actual: ' + (x.toString())); $ERROR('#2: Array.prototype.toString = Object.prototype.toString; var x = new Array(0,1,2); x.toString() === "[object " + "Array" + "]". Actual: ' + (x.toString()));
} }

View File

@ -15,7 +15,7 @@ if (x.getClass() !== "[object " + "Array" + "]") {
} }
//CHECK#2 //CHECK#2
var x = new Array(0,1,2); var x = new Array(0, 1, 2);
x.getClass = Object.prototype.toString; x.getClass = Object.prototype.toString;
if (x.getClass() !== "[object " + "Array" + "]") { if (x.getClass() !== "[object " + "Array" + "]") {
$ERROR('#2: var x = new Array(0,1,2); x.getClass = Object.prototype.toString; x is Array object. Actual: ' + (x.getClass())); $ERROR('#2: var x = new Array(0,1,2); x.getClass = Object.prototype.toString; x is Array object. Actual: ' + (x.getClass()));

View File

@ -15,8 +15,8 @@ if (new Array().length !== 0) {
} }
//CHECK#2 //CHECK#2
if (new Array(0,1,0,1).length !== 4) { if (new Array(0, 1, 0, 1).length !== 4) {
$ERROR('#2: new Array(0,1,0,1).length === 4. Actual: ' + (new Array(0,1,0,1).length)); $ERROR('#2: new Array(0,1,0,1).length === 4. Actual: ' + (new Array(0, 1, 0, 1).length));
} }
//CHECK#3 //CHECK#3

View File

@ -14,16 +14,16 @@ description: Checking correct work this algorithm
//CHECK# //CHECK#
var x = new Array( var x = new Array(
0,1,2,3,4,5,6,7,8,9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10,11,12,13,14,15,16,17,18,19, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20,21,22,23,24,25,26,27,28,29, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30,31,32,33,34,35,36,37,38,39, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40,41,42,43,44,45,46,47,48,49, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50,51,52,53,54,55,56,57,58,59, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60,61,62,63,64,65,66,67,68,69, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
70,71,72,73,74,75,76,77,78,79, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80,81,82,83,84,85,86,87,88,89, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
90,91,92,93,94,95,96,97,98,99 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
); );
for (var i = 0; i < 100; i++) { for (var i = 0; i < 100; i++) {

View File

@ -13,7 +13,7 @@ description: Checking an inherited property
//CHECK#1 //CHECK#1
Array.prototype[2] = -1; Array.prototype[2] = -1;
var x = [0,1,2]; var x = [0, 1, 2];
if (x[2] !== 2) { if (x[2] !== 2) {
$ERROR('#1: Array.prototype[2] = -1; x = [0,1,3]; x[2] === 2. Actual: ' + (x[2])); $ERROR('#1: Array.prototype[2] = -1; x = [0,1,3]; x[2] === 2. Actual: ' + (x[2]));
} }

View File

@ -18,7 +18,7 @@ if (x.length !== 0) {
} }
//CHECK#2 //CHECK#2
var y =[]; var y = [];
y[1] = 1; y[1] = 1;
y[4294967295] = 1; y[4294967295] = 1;
if (y.length !== 2) { if (y.length !== 2) {

View File

@ -21,7 +21,7 @@ try {
x = []; x = [];
x.length = 4294967296; x.length = 4294967296;
$ERROR('#2.1: x = []; x.length = 4294967296 throw RangeError. Actual: x.length === ' + (x.length)); $ERROR('#2.1: x = []; x.length = 4294967296 throw RangeError. Actual: x.length === ' + (x.length));
} catch(e) { } catch (e) {
if ((e instanceof RangeError) !== true) { if ((e instanceof RangeError) !== true) {
$ERROR('#2.2: x = []; x.length = 4294967296 throw RangeError. Actual: ' + (e)); $ERROR('#2.2: x = []; x.length = 4294967296 throw RangeError. Actual: ' + (e));
} }

View File

@ -11,7 +11,11 @@ description: If Type(value) is Object, evaluate ToPrimitive(value, String)
//CHECK#1 //CHECK#1
var x = []; var x = [];
var object = {valueOf: function() {return 1}}; var object = {
valueOf: function() {
return 1
}
};
x[object] = 0; x[object] = 0;
if (x["[object Object]"] !== 0) { if (x["[object Object]"] !== 0) {
$ERROR('#1: x = []; var object = {valueOf: function() {return 1}}; x[object] = 0; x["[object Object]"] === 0. Actual: ' + (x["[object Object]"])); $ERROR('#1: x = []; var object = {valueOf: function() {return 1}}; x[object] = 0; x["[object Object]"] === 0. Actual: ' + (x["[object Object]"]));
@ -19,7 +23,14 @@ if (x["[object Object]"] !== 0) {
//CHECK#2 //CHECK#2
x = []; x = [];
var object = {valueOf: function() {return 1}, toString: function() {return 0}}; var object = {
valueOf: function() {
return 1
},
toString: function() {
return 0
}
};
x[object] = 0; x[object] = 0;
if (x[0] !== 0) { if (x[0] !== 0) {
$ERROR('#2: x = []; var object = {valueOf: function() {return 1}, toString: function() {return 0}}; x[object] = 0; x[0] === 0. Actual: ' + (x[0])); $ERROR('#2: x = []; var object = {valueOf: function() {return 1}, toString: function() {return 0}}; x[object] = 0; x[0] === 0. Actual: ' + (x[0]));
@ -27,7 +38,14 @@ if (x[0] !== 0) {
//CHECK#3 //CHECK#3
x = []; x = [];
var object = {valueOf: function() {return 1}, toString: function() {return {}}}; var object = {
valueOf: function() {
return 1
},
toString: function() {
return {}
}
};
x[object] = 0; x[object] = 0;
if (x[1] !== 0) { if (x[1] !== 0) {
$ERROR('#3: x = []; var object = {valueOf: function() {return 1}, toString: function() {return {}}}; x[object] = 0; x[1] === 0. Actual: ' + (x[1])); $ERROR('#3: x = []; var object = {valueOf: function() {return 1}, toString: function() {return {}}}; x[object] = 0; x[1] === 0. Actual: ' + (x[1]));
@ -36,7 +54,14 @@ if (x[1] !== 0) {
//CHECK#4 //CHECK#4
try { try {
x = []; x = [];
var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; var object = {
valueOf: function() {
throw "error"
},
toString: function() {
return 1
}
};
x[object] = 0; x[object] = 0;
if (x[1] !== 0) { if (x[1] !== 0) {
$ERROR('#4.1: x = []; var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; x[object] = 0; x[1] === 1. Actual: ' + (x[1])); $ERROR('#4.1: x = []; var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; x[object] = 0; x[1] === 1. Actual: ' + (x[1]));
@ -52,7 +77,11 @@ catch (e) {
//CHECK#5 //CHECK#5
x = []; x = [];
var object = {toString: function() {return 1}}; var object = {
toString: function() {
return 1
}
};
x[object] = 0; x[object] = 0;
if (x[1] !== 0) { if (x[1] !== 0) {
$ERROR('#5: x = []; var object = {toString: function() {return 1}}; x[object] = 0; x[1] === 0. Actual: ' + (x[1])); $ERROR('#5: x = []; var object = {toString: function() {return 1}}; x[object] = 0; x[1] === 0. Actual: ' + (x[1]));
@ -60,7 +89,14 @@ if (x[1] !== 0) {
//CHECK#6 //CHECK#6
x = []; x = [];
var object = {valueOf: function() {return {}}, toString: function() {return 1}} var object = {
valueOf: function() {
return {}
},
toString: function() {
return 1
}
}
x[object] = 0; x[object] = 0;
if (x[1] !== 0) { if (x[1] !== 0) {
$ERROR('#6: x = []; var object = {valueOf: function() {return {}}, toString: function() {return 1}}; x[object] = 0; x[1] === 0. Actual: ' + (x[1])); $ERROR('#6: x = []; var object = {valueOf: function() {return {}}, toString: function() {return 1}}; x[object] = 0; x[1] === 0. Actual: ' + (x[1]));
@ -69,7 +105,14 @@ if (x[1] !== 0) {
//CHECK#7 //CHECK#7
try { try {
x = []; x = [];
var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; var object = {
valueOf: function() {
return 1
},
toString: function() {
throw "error"
}
};
x[object]; x[object];
$ERROR('#7.1: x = []; var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; x[object] throw "error". Actual: ' + (x[object])); $ERROR('#7.1: x = []; var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; x[object] throw "error". Actual: ' + (x[object]));
} }
@ -82,7 +125,14 @@ catch (e) {
//CHECK#8 //CHECK#8
try { try {
x = []; x = [];
var object = {valueOf: function() {return {}}, toString: function() {return {}}}; var object = {
valueOf: function() {
return {}
},
toString: function() {
return {}
}
};
x[object]; x[object];
$ERROR('#8.1: x = []; var object = {valueOf: function() {return {}}, toString: function() {return {}}}; x[object] throw TypeError. Actual: ' + (x[object])); $ERROR('#8.1: x = []; var object = {valueOf: function() {return {}}, toString: function() {return {}}}; x[object] throw TypeError. Actual: ' + (x[object]));
} }

View File

@ -28,7 +28,9 @@ function MyCollection() {
this.args = arguments; this.args = arguments;
} }
result = Array.from.call(MyCollection, {length: 42}); result = Array.from.call(MyCollection, {
length: 42
});
assert.sameValue(result.args.length, 1); assert.sameValue(result.args.length, 1);
assert.sameValue(result.args[0], 42); assert.sameValue(result.args[0], 42);

View File

@ -34,7 +34,7 @@ var list = {
}; };
var calls = []; var calls = [];
function mapFn (value) { function mapFn(value) {
calls.push({ calls.push({
args: arguments, args: arguments,
thisArg: this thisArg: this

View File

@ -34,7 +34,7 @@ var list = {
}; };
var calls = []; var calls = [];
function mapFn (value) { function mapFn(value) {
calls.push({ calls.push({
args: arguments, args: arguments,
thisArg: this thisArg: this

View File

@ -35,7 +35,7 @@ var list = {
var calls = []; var calls = [];
var thisArg = {}; var thisArg = {};
function mapFn (value) { function mapFn(value) {
calls.push({ calls.push({
args: arguments, args: arguments,
thisArg: this thisArg: this

View File

@ -19,7 +19,8 @@ var obj = {
5: 64, 5: 64,
6: 128 6: 128
}; };
var array = [ 2, 4, 8, 16, 32, 64, 128 ]; var array = [2, 4, 8, 16, 32, 64, 128];
function mapFn(value, index) { function mapFn(value, index) {
arrayIndex++; arrayIndex++;
assert.sameValue(value, obj[arrayIndex], "Value mismatch in mapFn at index " + index + "."); assert.sameValue(value, obj[arrayIndex], "Value mismatch in mapFn at index " + index + ".");

View File

@ -9,10 +9,11 @@ esid: sec-array.from
es6id: 22.1.2.1 es6id: 22.1.2.1
---*/ ---*/
var originalArray = [ 0, 1, -2, 4, -8, 16 ]; var originalArray = [0, 1, -2, 4, -8, 16];
var array = [ 0, 1, -2, 4, -8, 16 ]; var array = [0, 1, -2, 4, -8, 16];
var a = []; var a = [];
var arrayIndex = -1; var arrayIndex = -1;
function mapFn(value, index) { function mapFn(value, index) {
this.arrayIndex++; this.arrayIndex++;
assert.sameValue(value, array[this.arrayIndex], "Value mismatch in mapFn at index " + index + "."); assert.sameValue(value, array[this.arrayIndex], "Value mismatch in mapFn at index " + index + ".");

View File

@ -7,8 +7,9 @@ esid: sec-array.from
es6id: 22.1.2.1 es6id: 22.1.2.1
---*/ ---*/
var array = [ 127, 4, 8, 16, 32, 64, 128 ]; var array = [127, 4, 8, 16, 32, 64, 128];
var arrayIndex = -1; var arrayIndex = -1;
function mapFn(value, index) { function mapFn(value, index) {
arrayIndex++; arrayIndex++;
if (index + 1 < array.length) { if (index + 1 < array.length) {

View File

@ -27,7 +27,9 @@ var items = {};
items[Symbol.iterator] = function() { items[Symbol.iterator] = function() {
return { return {
next: function() { next: function() {
return { done: true }; return {
done: true
};
} }
}; };
}; };

View File

@ -26,8 +26,14 @@ features: [Symbol.iterator]
---*/ ---*/
var args = []; var args = [];
var firstResult = { done: false, value: {} }; var firstResult = {
var secondResult = { done: false, value: {} }; done: false,
value: {}
};
var secondResult = {
done: false,
value: {}
};
var mapFn = function(value, idx) { var mapFn = function(value, idx) {
args.push(arguments); args.push(arguments);
}; };
@ -40,7 +46,9 @@ items[Symbol.iterator] = function() {
next: function() { next: function() {
var result = nextResult; var result = nextResult;
nextResult = nextNextResult; nextResult = nextNextResult;
nextNextResult = { done: true }; nextNextResult = {
done: true
};
return result; return result;
} }

View File

@ -25,8 +25,14 @@ features: [Symbol.iterator]
---*/ ---*/
var thisVals = []; var thisVals = [];
var nextResult = { done: false, value: {} }; var nextResult = {
var nextNextResult = { done: false, value: {} }; done: false,
value: {}
};
var nextNextResult = {
done: false,
value: {}
};
var firstReturnVal = {}; var firstReturnVal = {};
var secondReturnVal = {}; var secondReturnVal = {};
var mapFn = function(value, idx) { var mapFn = function(value, idx) {
@ -45,7 +51,9 @@ items[Symbol.iterator] = function() {
next: function() { next: function() {
var result = nextResult; var result = nextResult;
nextResult = nextNextResult; nextResult = nextNextResult;
nextNextResult = { done: true }; nextNextResult = {
done: true
};
return result; return result;
} }

View File

@ -23,8 +23,14 @@ features: [Symbol.iterator]
---*/ ---*/
var thisVals = []; var thisVals = [];
var nextResult = { done: false, value: {} }; var nextResult = {
var nextNextResult = { done: false, value: {} }; done: false,
value: {}
};
var nextNextResult = {
done: false,
value: {}
};
var mapFn = function() { var mapFn = function() {
thisVals.push(this); thisVals.push(this);
}; };
@ -36,7 +42,9 @@ items[Symbol.iterator] = function() {
next: function() { next: function() {
var result = nextResult; var result = nextResult;
nextResult = nextNextResult; nextResult = nextNextResult;
nextNextResult = { done: true }; nextNextResult = {
done: true
};
return result; return result;
} }

View File

@ -24,20 +24,30 @@ flags: [noStrict]
---*/ ---*/
var thisVals = []; var thisVals = [];
var nextResult = { done: false, value: {} }; var nextResult = {
var nextNextResult = { done: false, value: {} }; done: false,
value: {}
};
var nextNextResult = {
done: false,
value: {}
};
var mapFn = function() { var mapFn = function() {
thisVals.push(this); thisVals.push(this);
}; };
var items = {}; var items = {};
var global = function() { return this; }(); var global = function() {
return this;
}();
items[Symbol.iterator] = function() { items[Symbol.iterator] = function() {
return { return {
next: function() { next: function() {
var result = nextResult; var result = nextResult;
nextResult = nextNextResult; nextResult = nextNextResult;
nextNextResult = { done: true }; nextNextResult = {
done: true
};
return result; return result;
} }

View File

@ -24,8 +24,14 @@ flags: [onlyStrict]
---*/ ---*/
var thisVals = []; var thisVals = [];
var nextResult = { done: false, value: {} }; var nextResult = {
var nextNextResult = { done: false, value: {} }; done: false,
value: {}
};
var nextNextResult = {
done: false,
value: {}
};
var mapFn = function() { var mapFn = function() {
thisVals.push(this); thisVals.push(this);
}; };
@ -36,7 +42,9 @@ items[Symbol.iterator] = function() {
next: function() { next: function() {
var result = nextResult; var result = nextResult;
nextResult = nextNextResult; nextResult = nextNextResult;
nextNextResult = { done: true }; nextNextResult = {
done: true
};
return result; return result;
} }

View File

@ -18,11 +18,15 @@ features: [Symbol.iterator]
---*/ ---*/
var C = function() { var C = function() {
Object.defineProperty(this, '0', { configurable: false }); Object.defineProperty(this, '0', {
configurable: false
});
}; };
var closeCount = 0; var closeCount = 0;
var items = {}; var items = {};
var nextResult = { done: false }; var nextResult = {
done: false
};
items[Symbol.iterator] = function() { items[Symbol.iterator] = function() {
return { return {
@ -32,7 +36,9 @@ items[Symbol.iterator] = function() {
next: function() { next: function() {
var result = nextResult; var result = nextResult;
nextResult = { done: true }; nextResult = {
done: true
};
return result; return result;
} }

View File

@ -16,9 +16,18 @@ features: [Symbol.iterator]
---*/ ---*/
var items = {}; var items = {};
var firstIterResult = { done: false, value: {} }; var firstIterResult = {
var secondIterResult = { done: false, value: {} }; done: false,
var thirdIterResult = { done: true, value: {} }; value: {}
};
var secondIterResult = {
done: false,
value: {}
};
var thirdIterResult = {
done: true,
value: {}
};
var nextIterResult = firstIterResult; var nextIterResult = firstIterResult;
var nextNextIterResult = secondIterResult; var nextNextIterResult = secondIterResult;
var result; var result;

View File

@ -25,7 +25,11 @@ Object.defineProperty(C.prototype, 'length', {
}); });
items[Symbol.iterator] = function() { items[Symbol.iterator] = function() {
return { return {
next: function() { return { done: true }; } next: function() {
return {
done: true
};
}
}; };
}; };

View File

@ -29,13 +29,19 @@ items[Symbol.iterator] = function() {
}; };
}; };
nextIterResult = lastIterResult = { done: true }; nextIterResult = lastIterResult = {
done: true
};
result = Array.from(items); result = Array.from(items);
assert.sameValue(result.length, 0); assert.sameValue(result.length, 0);
nextIterResult = { done: false }; nextIterResult = {
lastIterResult = { done: true }; done: false
};
lastIterResult = {
done: true
};
result = Array.from(items); result = Array.from(items);
assert.sameValue(result.length, 1); assert.sameValue(result.length, 1);

View File

@ -7,9 +7,12 @@ esid: sec-array.from
es6id: 22.1.2.1 es6id: 22.1.2.1
---*/ ---*/
var array = [ 2, 4, 8, 16, 32, 64, 128 ]; var array = [2, 4, 8, 16, 32, 64, 128];
function mapFn(value, index, obj) { function mapFn(value, index, obj) {
throw new Test262Error(); throw new Test262Error();
} }
assert.throws(Test262Error, function(){Array.from(array, mapFn);}); assert.throws(Test262Error, function() {
Array.from(array, mapFn);
});

View File

@ -7,8 +7,9 @@ esid: sec-array.from
es6id: 22.1.2.1 es6id: 22.1.2.1
---*/ ---*/
var array = [ Number.MAX_VALUE, Number.MIN_VALUE, Number.NaN, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY ]; var array = [Number.MAX_VALUE, Number.MIN_VALUE, Number.NaN, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY];
var arrayIndex = -1; var arrayIndex = -1;
function mapFn(value, index) { function mapFn(value, index) {
this.arrayIndex++; this.arrayIndex++;
assert.sameValue(value, array[this.arrayIndex], "Value mismatch in mapFn at index " + index + "."); assert.sameValue(value, array[this.arrayIndex], "Value mismatch in mapFn at index " + index + ".");

View File

@ -8,7 +8,7 @@ es6id: 22.1.2.1
features: [Symbol.iterator] features: [Symbol.iterator]
---*/ ---*/
var array = [ 2, 4, 8, 16, 32, 64, 128 ]; var array = [2, 4, 8, 16, 32, 64, 128];
var obj = { var obj = {
[Symbol.iterator]() { [Symbol.iterator]() {
return { return {
@ -16,7 +16,7 @@ var obj = {
next() { next() {
throw new Test262Error(); throw new Test262Error();
}, },
isDone : false, isDone: false,
get val() { get val() {
this.index++; this.index++;
if (this.index > 7) { if (this.index > 7) {
@ -27,4 +27,6 @@ var obj = {
}; };
} }
}; };
assert.throws(Test262Error, function(){Array.from(obj);}); assert.throws(Test262Error, function() {
Array.from(obj);
});

View File

@ -8,7 +8,7 @@ es6id: 22.1.2.1
features: [Symbol.iterator] features: [Symbol.iterator]
---*/ ---*/
var array = [ 2, 4, 8, 16, 32, 64, 128 ]; var array = [2, 4, 8, 16, 32, 64, 128];
var obj = { var obj = {
[Symbol.iterator]() { [Symbol.iterator]() {
return { return {
@ -19,7 +19,7 @@ var obj = {
done: this.isDone done: this.isDone
}; };
}, },
isDone : false, isDone: false,
get val() { get val() {
this.index++; this.index++;
if (this.index > 7) { if (this.index > 7) {

View File

@ -12,11 +12,11 @@ es6id: 22.1.2.1
var array = [2, 4, 0, 16]; var array = [2, 4, 0, 16];
var expectedArray = [2, 4, , 16]; var expectedArray = [2, 4, , 16];
var obj = { var obj = {
length : 4, length: 4,
0 : 2, 0: 2,
1 : 4, 1: 4,
2 : 0, 2: 0,
3 : 16 3: 16
}; };
delete obj[2]; delete obj[2];
var a = Array.from(obj); var a = Array.from(obj);

View File

@ -7,4 +7,4 @@ es5id: 15.4.3.2-1-7
description: Array.isArray applied to Function object description: Array.isArray applied to Function object
---*/ ---*/
assert.sameValue(Array.isArray(function () { }), false, 'Array.isArray(function () { })'); assert.sameValue(Array.isArray(function() {}), false, 'Array.isArray(function () { })');

View File

@ -8,7 +8,7 @@ description: Array.isArray applied to an object with an array as the prototype
---*/ ---*/
var proto = []; var proto = [];
var Con = function () { }; var Con = function() {};
Con.prototype = proto; Con.prototype = proto;
var child = new Con(); var child = new Con();

View File

@ -9,10 +9,10 @@ description: >
prototype prototype
---*/ ---*/
var proto = Array.prototype; var proto = Array.prototype;
var Con = function () { }; var Con = function() {};
Con.prototype = proto; Con.prototype = proto;
var child = new Con(); var child = new Con();
assert.sameValue(Array.isArray(child), false, 'Array.isArray(child)'); assert.sameValue(Array.isArray(child), false, 'Array.isArray(child)');

View File

@ -9,4 +9,8 @@ description: >
indexed properties indexed properties
---*/ ---*/
assert.sameValue(Array.isArray({ 0: 12, 1: 9, length: 2 }), false, 'Array.isArray({ 0: 12, 1: 9, length: 2 })'); assert.sameValue(Array.isArray({
0: 12,
1: 9,
length: 2
}), false, 'Array.isArray({ 0: 12, 1: 9, length: 2 })');

View File

@ -11,5 +11,5 @@ description: >
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
[].length = 4294967296 ; [].length = 4294967296;
}); });

View File

@ -11,5 +11,5 @@ description: >
assert.throws(RangeError, function() { assert.throws(RangeError, function() {
[].length = 4294967297 ; [].length = 4294967297;
}); });

View File

@ -7,7 +7,7 @@ es5id: 15.4.5.1-3.d-3
description: Set array length property to max value 4294967295 (2**32-1,) description: Set array length property to max value 4294967295 (2**32-1,)
---*/ ---*/
var a =[]; var a = [];
a.length = 4294967295 ; a.length = 4294967295;
assert.sameValue(a.length, 4294967295, 'a.length'); assert.sameValue(a.length, 4294967295, 'a.length');

View File

@ -14,7 +14,7 @@ description: Use try statement. len = -1, 4294967296, 4294967297
try { try {
new Array(-1); new Array(-1);
$ERROR('#1.1: new Array(-1) throw RangeError. Actual: ' + (new Array(-1))); $ERROR('#1.1: new Array(-1) throw RangeError. Actual: ' + (new Array(-1)));
} catch(e) { } catch (e) {
if ((e instanceof RangeError) !== true) { if ((e instanceof RangeError) !== true) {
$ERROR('#1.2: new Array(-1) throw RangeError. Actual: ' + (e)); $ERROR('#1.2: new Array(-1) throw RangeError. Actual: ' + (e));
} }
@ -24,7 +24,7 @@ try {
try { try {
new Array(4294967296); new Array(4294967296);
$ERROR('#2.1: new Array(4294967296) throw RangeError. Actual: ' + (new Array(4294967296))); $ERROR('#2.1: new Array(4294967296) throw RangeError. Actual: ' + (new Array(4294967296)));
} catch(e) { } catch (e) {
if ((e instanceof RangeError) !== true) { if ((e instanceof RangeError) !== true) {
$ERROR('#2.2: new Array(4294967296) throw RangeError. Actual: ' + (e)); $ERROR('#2.2: new Array(4294967296) throw RangeError. Actual: ' + (e));
} }
@ -34,7 +34,7 @@ try {
try { try {
new Array(4294967297); new Array(4294967297);
$ERROR('#3.1: new Array(4294967297) throw RangeError. Actual: ' + (new Array(4294967297))); $ERROR('#3.1: new Array(4294967297) throw RangeError. Actual: ' + (new Array(4294967297)));
} catch(e) { } catch (e) {
if ((e instanceof RangeError) !== true) { if ((e instanceof RangeError) !== true) {
$ERROR('#3.2: new Array(4294967297) throw RangeError. Actual: ' + (e)); $ERROR('#3.2: new Array(4294967297) throw RangeError. Actual: ' + (e));
} }

View File

@ -14,7 +14,7 @@ description: Use try statement. len = NaN, +/-Infinity
try { try {
new Array(NaN); new Array(NaN);
$ERROR('#1.1: new Array(NaN) throw RangeError. Actual: ' + (new Array(NaN))); $ERROR('#1.1: new Array(NaN) throw RangeError. Actual: ' + (new Array(NaN)));
} catch(e) { } catch (e) {
if ((e instanceof RangeError) !== true) { if ((e instanceof RangeError) !== true) {
$ERROR('#1.2: new Array(NaN) throw RangeError. Actual: ' + (e)); $ERROR('#1.2: new Array(NaN) throw RangeError. Actual: ' + (e));
} }
@ -24,7 +24,7 @@ try {
try { try {
new Array(Number.POSITIVE_INFINITY); new Array(Number.POSITIVE_INFINITY);
$ERROR('#2.1: new Array(Number.POSITIVE_INFINITY) throw RangeError. Actual: ' + (new Array(Number.POSITIVE_INFINITY))); $ERROR('#2.1: new Array(Number.POSITIVE_INFINITY) throw RangeError. Actual: ' + (new Array(Number.POSITIVE_INFINITY)));
} catch(e) { } catch (e) {
if ((e instanceof RangeError) !== true) { if ((e instanceof RangeError) !== true) {
$ERROR('#2.2: new Array(Number.POSITIVE_INFINITY) throw RangeError. Actual: ' + (e)); $ERROR('#2.2: new Array(Number.POSITIVE_INFINITY) throw RangeError. Actual: ' + (e));
} }
@ -34,7 +34,7 @@ try {
try { try {
new Array(Number.NEGATIVE_INFINITY); new Array(Number.NEGATIVE_INFINITY);
$ERROR('#3.1: new Array(Number.NEGATIVE_INFINITY) throw RangeError. Actual: ' + (new Array(Number.NEGATIVE_INFINITY))); $ERROR('#3.1: new Array(Number.NEGATIVE_INFINITY) throw RangeError. Actual: ' + (new Array(Number.NEGATIVE_INFINITY)));
} catch(e) { } catch (e) {
if ((e instanceof RangeError) !== true) { if ((e instanceof RangeError) !== true) {
$ERROR('#3.2: new Array(Number.NEGATIVE_INFINITY) throw RangeError. Actual: ' + (e)); $ERROR('#3.2: new Array(Number.NEGATIVE_INFINITY) throw RangeError. Actual: ' + (e));
} }

View File

@ -14,7 +14,7 @@ description: Use try statement. len = 1.5, Number.MAX_VALUE, Number.MIN_VALUE
try { try {
new Array(1.5); new Array(1.5);
$ERROR('#1.1: new Array(1.5) throw RangeError. Actual: ' + (new Array(1.5))); $ERROR('#1.1: new Array(1.5) throw RangeError. Actual: ' + (new Array(1.5)));
} catch(e) { } catch (e) {
if ((e instanceof RangeError) !== true) { if ((e instanceof RangeError) !== true) {
$ERROR('#1.2: new Array(1.5) throw RangeError. Actual: ' + (e)); $ERROR('#1.2: new Array(1.5) throw RangeError. Actual: ' + (e));
} }
@ -24,7 +24,7 @@ try {
try { try {
new Array(Number.MAX_VALUE); new Array(Number.MAX_VALUE);
$ERROR('#2.1: new Array(Number.MAX_VALUE) throw RangeError. Actual: ' + (new Array(Number.MAX_VALUE))); $ERROR('#2.1: new Array(Number.MAX_VALUE) throw RangeError. Actual: ' + (new Array(Number.MAX_VALUE)));
} catch(e) { } catch (e) {
if ((e instanceof RangeError) !== true) { if ((e instanceof RangeError) !== true) {
$ERROR('#2.2: new Array(Number.MAX_VALUE) throw RangeError. Actual: ' + (e)); $ERROR('#2.2: new Array(Number.MAX_VALUE) throw RangeError. Actual: ' + (e));
} }
@ -34,7 +34,7 @@ try {
try { try {
new Array(Number.MIN_VALUE); new Array(Number.MIN_VALUE);
$ERROR('#3.1: new Array(Number.MIN_VALUE) throw RangeError. Actual: ' + (new Array(Number.MIN_VALUE))); $ERROR('#3.1: new Array(Number.MIN_VALUE) throw RangeError. Actual: ' + (new Array(Number.MIN_VALUE)));
} catch(e) { } catch (e) {
if ((e instanceof RangeError) !== true) { if ((e instanceof RangeError) !== true) {
$ERROR('#3.2: new Array(Number.MIN_VALUE) throw RangeError. Actual: ' + (e)); $ERROR('#3.2: new Array(Number.MIN_VALUE) throw RangeError. Actual: ' + (e));
} }

View File

@ -13,7 +13,7 @@ try {
var x = []; var x = [];
x.length = 4294967296; x.length = 4294967296;
$ERROR('#1.1: x = []; x.length = 4294967296 throw RangeError. Actual: x.length === ' + (x.length)); $ERROR('#1.1: x = []; x.length = 4294967296 throw RangeError. Actual: x.length === ' + (x.length));
} catch(e) { } catch (e) {
if ((e instanceof RangeError) !== true) { if ((e instanceof RangeError) !== true) {
$ERROR('#1.2: x = []; x.length = 4294967296 throw RangeError. Actual: ' + (e)); $ERROR('#1.2: x = []; x.length = 4294967296 throw RangeError. Actual: ' + (e));
} }
@ -24,7 +24,7 @@ try {
x = []; x = [];
x.length = -1; x.length = -1;
$ERROR('#2.1: x = []; x.length = -1 throw RangeError. Actual: x.length === ' + (x.length)); $ERROR('#2.1: x = []; x.length = -1 throw RangeError. Actual: x.length === ' + (x.length));
} catch(e) { } catch (e) {
if ((e instanceof RangeError) !== true) { if ((e instanceof RangeError) !== true) {
$ERROR('#2.2: x = []; x.length = -1 throw RangeError. Actual: ' + (e)); $ERROR('#2.2: x = []; x.length = -1 throw RangeError. Actual: ' + (e));
} }
@ -35,7 +35,7 @@ try {
x = []; x = [];
x.length = 1.5; x.length = 1.5;
$ERROR('#3.1: x = []; x.length = 1.5 throw RangeError. Actual: x.length === ' + (x.length)); $ERROR('#3.1: x = []; x.length = 1.5 throw RangeError. Actual: x.length === ' + (x.length));
} catch(e) { } catch (e) {
if ((e instanceof RangeError) !== true) { if ((e instanceof RangeError) !== true) {
$ERROR('#3.2: x = []; x.length = 1.5 throw RangeError. Actual: ' + (e)); $ERROR('#3.2: x = []; x.length = 1.5 throw RangeError. Actual: ' + (e));
} }

View File

@ -13,7 +13,7 @@ try {
var x = []; var x = [];
x.length = NaN; x.length = NaN;
$ERROR('#1.1: x = []; x.length = NaN throw RangeError. Actual: x.length === ' + (x.length)); $ERROR('#1.1: x = []; x.length = NaN throw RangeError. Actual: x.length === ' + (x.length));
} catch(e) { } catch (e) {
if ((e instanceof RangeError) !== true) { if ((e instanceof RangeError) !== true) {
$ERROR('#1.2: x = []; x.length = NaN throw RangeError. Actual: ' + (e)); $ERROR('#1.2: x = []; x.length = NaN throw RangeError. Actual: ' + (e));
} }
@ -24,7 +24,7 @@ try {
x = []; x = [];
x.length = Number.POSITIVE_INFINITY; x.length = Number.POSITIVE_INFINITY;
$ERROR('#2.1: x = []; x.length = Number.POSITIVE_INFINITY throw RangeError. Actual: x.length === ' + (x.length)); $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) { if ((e instanceof RangeError) !== true) {
$ERROR('#2.2: x = []; x.length = Number.POSITIVE_INFINITY throw RangeError. Actual: ' + (e)); $ERROR('#2.2: x = []; x.length = Number.POSITIVE_INFINITY throw RangeError. Actual: ' + (e));
} }
@ -35,7 +35,7 @@ try {
x = []; x = [];
x.length = Number.NEGATIVE_INFINITY; x.length = Number.NEGATIVE_INFINITY;
$ERROR('#3.1: x = []; x.length = Number.NEGATIVE_INFINITY throw RangeError. Actual: x.length === ' + (x.length)); $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) { if ((e instanceof RangeError) !== true) {
$ERROR('#3.2: x = []; x.length = Number.NEGATIVE_INFINITY throw RangeError. Actual: ' + (e)); $ERROR('#3.2: x = []; x.length = Number.NEGATIVE_INFINITY throw RangeError. Actual: ' + (e));
} }
@ -46,7 +46,7 @@ try {
x = []; x = [];
x.length = undefined; x.length = undefined;
$ERROR('#4.1: x = []; x.length = undefined throw RangeError. Actual: x.length === ' + (x.length)); $ERROR('#4.1: x = []; x.length = undefined throw RangeError. Actual: x.length === ' + (x.length));
} catch(e) { } catch (e) {
if ((e instanceof RangeError) !== true) { if ((e instanceof RangeError) !== true) {
$ERROR('#4.2: x = []; x.length = undefined throw RangeError. Actual: ' + (e)); $ERROR('#4.2: x = []; x.length = undefined throw RangeError. Actual: ' + (e));
} }

View File

@ -13,7 +13,7 @@ description: Change length of array
---*/ ---*/
//CHECK#1 //CHECK#1
var x = [0,,2,,4]; var x = [0, , 2, , 4];
x.length = 4; x.length = 4;
if (x[4] !== undefined) { if (x[4] !== undefined) {
$ERROR('#1: x = [0,,2,,4]; x.length = 4; x[4] === undefined. Actual: ' + (x[4])); $ERROR('#1: x = [0,,2,,4]; x.length = 4; x[4] === undefined. Actual: ' + (x[4]));

View File

@ -14,7 +14,7 @@ description: Checking an inherited property
//CHECK#1 //CHECK#1
Array.prototype[2] = 2; Array.prototype[2] = 2;
var x = [0,1]; var x = [0, 1];
x.length = 3; x.length = 3;
if (x.hasOwnProperty('2') !== false) { 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'))); $ERROR('#1: Array.prototype[2] = 2; x = [0,1]; x.length = 3; x.hasOwnProperty(\'2\') === false. Actual: ' + (x.hasOwnProperty('2')));

View File

@ -10,21 +10,39 @@ description: Uint32 use ToNumber and ToPrimitve
//CHECK#1 //CHECK#1
var x = []; var x = [];
x.length = {valueOf: function() {return 2}}; x.length = {
valueOf: function() {
return 2
}
};
if (x.length !== 2) { if (x.length !== 2) {
$ERROR('#1: x = []; x.length = {valueOf: function() {return 2}}; x.length === 2. Actual: ' + (x.length)); $ERROR('#1: x = []; x.length = {valueOf: function() {return 2}}; x.length === 2. Actual: ' + (x.length));
} }
//CHECK#2 //CHECK#2
x = []; x = [];
x.length = {valueOf: function() {return 2}, toString: function() {return 1}}; x.length = {
valueOf: function() {
return 2
},
toString: function() {
return 1
}
};
if (x.length !== 2) { if (x.length !== 2) {
$ERROR('#0: x = []; x.length = {valueOf: function() {return 2}, toString: function() {return 1}}; x.length === 2. Actual: ' + (x.length)); $ERROR('#0: x = []; x.length = {valueOf: function() {return 2}, toString: function() {return 1}}; x.length === 2. Actual: ' + (x.length));
} }
//CHECK#3 //CHECK#3
x = []; x = [];
x.length = {valueOf: function() {return 2}, toString: function() {return {}}}; x.length = {
valueOf: function() {
return 2
},
toString: function() {
return {}
}
};
if (x.length !== 2) { if (x.length !== 2) {
$ERROR('#3: x = []; x.length = {valueOf: function() {return 2}, toString: function() {return {}}}; x.length === 2. Actual: ' + (x.length)); $ERROR('#3: x = []; x.length = {valueOf: function() {return 2}, toString: function() {return {}}}; x.length === 2. Actual: ' + (x.length));
} }
@ -32,7 +50,14 @@ if (x.length !== 2) {
//CHECK#4 //CHECK#4
try { try {
x = []; 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) { if (x.length !== 2) {
$ERROR('#4.1: x = []; x.length = {valueOf: function() {return 2}, toString: function() {throw "error"}}; x.length === ",". Actual: ' + (x.length)); $ERROR('#4.1: x = []; x.length = {valueOf: function() {return 2}, toString: function() {throw "error"}}; x.length === ",". Actual: ' + (x.length));
} }
@ -47,14 +72,25 @@ catch (e) {
//CHECK#5 //CHECK#5
x = []; x = [];
x.length = {toString: function() {return 1}}; x.length = {
toString: function() {
return 1
}
};
if (x.length !== 1) { if (x.length !== 1) {
$ERROR('#5: x = []; x.length = {toString: function() {return 1}}; x.length === 1. Actual: ' + (x.length)); $ERROR('#5: x = []; x.length = {toString: function() {return 1}}; x.length === 1. Actual: ' + (x.length));
} }
//CHECK#6 //CHECK#6
x = []; x = [];
x.length = {valueOf: function() {return {}}, toString: function() {return 1}} x.length = {
valueOf: function() {
return {}
},
toString: function() {
return 1
}
}
if (x.length !== 1) { if (x.length !== 1) {
$ERROR('#6: x = []; x.length = {valueOf: function() {return {}}, toString: function() {return 1}}; x.length === 1. Actual: ' + (x.length)); $ERROR('#6: x = []; x.length = {valueOf: function() {return {}}, toString: function() {return 1}}; x.length === 1. Actual: ' + (x.length));
} }
@ -62,7 +98,14 @@ if (x.length !== 1) {
//CHECK#7 //CHECK#7
try { try {
x = []; x = [];
x.length = {valueOf: function() {throw "error"}, toString: function() {return 1}}; x.length = {
valueOf: function() {
throw "error"
},
toString: function() {
return 1
}
};
x.length; x.length;
$ERROR('#7.1: x = []; x.length = {valueOf: function() {throw "error"}, toString: function() {return 1}}; x.length throw "error". Actual: ' + (x.length)); $ERROR('#7.1: x = []; x.length = {valueOf: function() {throw "error"}, toString: function() {return 1}}; x.length throw "error". Actual: ' + (x.length));
} }
@ -75,7 +118,14 @@ catch (e) {
//CHECK#8 //CHECK#8
try { try {
x = []; x = [];
x.length = {valueOf: function() {return {}}, toString: function() {return {}}}; x.length = {
valueOf: function() {
return {}
},
toString: function() {
return {}
}
};
x.length; x.length;
$ERROR('#8.1: x = []; x.length = {valueOf: function() {return {}}, toString: function() {return {}}} x.length throw TypeError. Actual: ' + (x.length)); $ERROR('#8.1: x = []; x.length = {valueOf: function() {return {}}, toString: function() {return {}}} x.length throw TypeError. Actual: ' + (x.length));
} }

View File

@ -13,7 +13,7 @@ description: >
---*/ ---*/
//CHECK#1 //CHECK#1
var x = [0,1,2]; var x = [0, 1, 2];
x[4294967294] = 4294967294; x[4294967294] = 4294967294;
x.length = 2; x.length = 2;

View File

@ -9,33 +9,33 @@ description: >
(read-only) exists in Array.prototype (Step 5.b.iii.3.b) (read-only) exists in Array.prototype (Step 5.b.iii.3.b)
---*/ ---*/
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
value: 100, value: 100,
writable: false, writable: false,
configurable: true configurable: true
}); });
var oldArr = [101]; var oldArr = [101];
var newArr = Array.prototype.concat.call(oldArr); var newArr = Array.prototype.concat.call(oldArr);
var verifyValue = false; var verifyValue = false;
verifyValue = newArr[0] === 101; verifyValue = newArr[0] === 101;
var verifyEnumerable = false; var verifyEnumerable = false;
for (var p in newArr) { for (var p in newArr) {
if (p === "0" && newArr.hasOwnProperty("0")) { if (p === "0" && newArr.hasOwnProperty("0")) {
verifyEnumerable = true; verifyEnumerable = true;
} }
} }
var verifyWritable = false; var verifyWritable = false;
newArr[0] = 12; newArr[0] = 12;
verifyWritable = newArr[0] === 12; verifyWritable = newArr[0] === 12;
var verifyConfigurable = false; var verifyConfigurable = false;
delete newArr[0]; delete newArr[0];
verifyConfigurable = newArr.hasOwnProperty("0"); verifyConfigurable = newArr.hasOwnProperty("0");
assert(verifyValue, 'verifyValue !== true'); assert(verifyValue, 'verifyValue !== true');
assert.sameValue(verifyConfigurable, false, 'verifyConfigurable'); assert.sameValue(verifyConfigurable, false, 'verifyConfigurable');

View File

@ -9,35 +9,35 @@ description: >
(read-only) exists in Array.prototype (Step 5.c.i) (read-only) exists in Array.prototype (Step 5.c.i)
---*/ ---*/
Object.defineProperty(Array.prototype, "0", { Object.defineProperty(Array.prototype, "0", {
value: 100, value: 100,
writable: false, writable: false,
configurable: true configurable: true
}); });
var newArr = Array.prototype.concat.call(101); var newArr = Array.prototype.concat.call(101);
var hasProperty = newArr.hasOwnProperty("0"); var hasProperty = newArr.hasOwnProperty("0");
var instanceOfVerify = typeof newArr[0]==="object"; var instanceOfVerify = typeof newArr[0] === "object";
var verifyValue = false; var verifyValue = false;
verifyValue = newArr[0] == 101; verifyValue = newArr[0] == 101;
var verifyEnumerable = false; var verifyEnumerable = false;
for (var p in newArr) { for (var p in newArr) {
if (p === "0" && newArr.hasOwnProperty("0")) { if (p === "0" && newArr.hasOwnProperty("0")) {
verifyEnumerable = true; verifyEnumerable = true;
} }
} }
var verifyWritable = false; var verifyWritable = false;
newArr[0] = 12; newArr[0] = 12;
verifyWritable = newArr[0] === 12; verifyWritable = newArr[0] === 12;
var verifyConfigurable = false; var verifyConfigurable = false;
delete newArr[0]; delete newArr[0];
verifyConfigurable = newArr.hasOwnProperty("0"); verifyConfigurable = newArr.hasOwnProperty("0");
assert(hasProperty, 'hasProperty !== true'); assert(hasProperty, 'hasProperty !== true');
assert(instanceOfVerify, 'instanceOfVerify !== true'); assert(instanceOfVerify, 'instanceOfVerify !== true');

View File

@ -10,9 +10,11 @@ features: [Symbol.isConcatSpreadable]
---*/ ---*/
function MyError() {} function MyError() {}
var obj = { var obj = {
"length": { toString: function() { "length": {
toString: function() {
throw new MyError(); throw new MyError();
}, valueOf: null },
valueOf: null
}, },
"1": "A", "1": "A",
"3": "B", "3": "B",

View File

@ -15,7 +15,17 @@ var obj = {
"5": "C" "5": "C"
}; };
obj[Symbol.isConcatSpreadable] = true; obj[Symbol.isConcatSpreadable] = true;
obj.length = {toString: function() { return "SIX"; }, valueOf: null }; obj.length = {
toString: function() {
return "SIX";
},
valueOf: null
};
assert(compareArray([].concat(obj), [])); assert(compareArray([].concat(obj), []));
obj.length = {toString: null, valueOf: function() { return "SIX"; } }; obj.length = {
toString: null,
valueOf: function() {
return "SIX";
}
};
assert(compareArray([].concat(obj), [])); assert(compareArray([].concat(obj), []));

View File

@ -16,7 +16,12 @@ var obj = {
"5": "C" "5": "C"
}; };
obj[Symbol.isConcatSpreadable] = true; obj[Symbol.isConcatSpreadable] = true;
var obj2 = { length: 3, "0": "0", "1": "1", "2": "2" }; var obj2 = {
length: 3,
"0": "0",
"1": "1",
"2": "2"
};
var arr = ["X", "Y", "Z"]; var arr = ["X", "Y", "Z"];
var expected = [ var expected = [

View File

@ -9,13 +9,21 @@ description: Array.prototype.concat array like to length throws
features: [Symbol.isConcatSpreadable] features: [Symbol.isConcatSpreadable]
---*/ ---*/
var obj = { var obj = {
"length": {valueOf: null, toString: null}, "length": {
valueOf: null,
toString: null
},
"1": "A", "1": "A",
"3": "B", "3": "B",
"5": "C" "5": "C"
}; };
obj[Symbol.isConcatSpreadable] = true; obj[Symbol.isConcatSpreadable] = true;
var obj2 = { length: 3, "0": "0", "1": "1", "2": "2" }; var obj2 = {
length: 3,
"0": "0",
"1": "1",
"2": "2"
};
var arr = ["X", "Y", "Z"]; var arr = ["X", "Y", "Z"];
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
Array.prototype.concat.call(obj, obj2, arr); Array.prototype.concat.call(obj, obj2, arr);

View File

@ -17,7 +17,12 @@ var obj = {
"5": "C" "5": "C"
}; };
obj[Symbol.isConcatSpreadable] = true; obj[Symbol.isConcatSpreadable] = true;
var obj2 = { length: 3, "0": "0", "1": "1", "2": "2" }; var obj2 = {
length: 3,
"0": "0",
"1": "1",
"2": "2"
};
var arr = ["X", "Y", "Z"]; var arr = ["X", "Y", "Z"];
var expected = [ var expected = [

View File

@ -10,7 +10,9 @@ description: Array.prototype.concat holey sloppy arguments
includes: [compareArray.js] includes: [compareArray.js]
features: [Symbol.isConcatSpreadable] features: [Symbol.isConcatSpreadable]
---*/ ---*/
var args = (function(a) { return arguments; })(1,2,3); var args = (function(a) {
return arguments;
})(1, 2, 3);
delete args[1]; delete args[1];
args[Symbol.isConcatSpreadable] = true; args[Symbol.isConcatSpreadable] = true;
assert(compareArray([1, void 0, 3, 1, void 0, 3], [].concat(args, args))); assert(compareArray([1, void 0, 3, 1, void 0, 3], [].concat(args, args)));

View File

@ -31,7 +31,9 @@ function concatTypedArray(type, elems, modulo) {
var expected = new Array(4000); var expected = new Array(4000);
expected[0] = defValue; expected[0] = defValue;
Object.defineProperty(ta, "length", { value: 4000 }); Object.defineProperty(ta, "length", {
value: 4000
});
ta[Symbol.isConcatSpreadable] = true; ta[Symbol.isConcatSpreadable] = true;
assert(compareArray([].concat(ta), expected)); assert(compareArray([].concat(ta), expected));
} }

View File

@ -13,7 +13,9 @@ function MyError() {}
var obj = {}; var obj = {};
obj[Symbol.isConcatSpreadable] = true; obj[Symbol.isConcatSpreadable] = true;
Object.defineProperty(obj, "length", { Object.defineProperty(obj, "length", {
get: function() { throw new MyError(); } get: function() {
throw new MyError();
}
}); });
assert.throws(MyError, function() { assert.throws(MyError, function() {

View File

@ -19,8 +19,8 @@ class NonArray {
} }
} }
var obj = new NonArray(1,2,3); var obj = new NonArray(1, 2, 3);
var result = Array.prototype.concat.call(obj, 4, 5, 6); var result = Array.prototype.concat.call(obj, 4, 5, 6);
assert.sameValue(Array, result.constructor); assert.sameValue(Array, result.constructor);
assert.sameValue(result instanceof NonArray, false); assert.sameValue(result instanceof NonArray, false);
assert(compareArray(result, [obj,4,5,6])); assert(compareArray(result, [obj, 4, 5, 6]));

View File

@ -10,9 +10,13 @@ description: Array.prototype.concat sloppy arguments throws
features: [Symbol.isConcatSpreadable] features: [Symbol.isConcatSpreadable]
---*/ ---*/
function MyError() {} function MyError() {}
var args = (function(a) { return arguments; })(1,2,3); var args = (function(a) {
return arguments;
})(1, 2, 3);
Object.defineProperty(args, 0, { Object.defineProperty(args, 0, {
get: function() { throw new MyError(); } get: function() {
throw new MyError();
}
}); });
args[Symbol.isConcatSpreadable] = true; args[Symbol.isConcatSpreadable] = true;
assert.throws(MyError, function() { assert.throws(MyError, function() {

View File

@ -11,9 +11,13 @@ flags: [noStrict]
includes: [compareArray.js] includes: [compareArray.js]
features: [Symbol.isConcatSpreadable] features: [Symbol.isConcatSpreadable]
---*/ ---*/
var args = (function(a, a, a) { return arguments; })(1,2,3); var args = (function(a, a, a) {
return arguments;
})(1, 2, 3);
args[Symbol.isConcatSpreadable] = true; args[Symbol.isConcatSpreadable] = true;
assert(compareArray([].concat(args, args), [1, 2, 3, 1, 2, 3])); assert(compareArray([].concat(args, args), [1, 2, 3, 1, 2, 3]));
Object.defineProperty(args, "length", { value: 6 }); Object.defineProperty(args, "length", {
value: 6
});
assert(compareArray([].concat(args), [1, 2, 3, void 0, void 0, void 0])); assert(compareArray([].concat(args), [1, 2, 3, void 0, void 0, void 0]));

View File

@ -10,9 +10,13 @@ description: Array.prototype.concat sloppy arguments
includes: [compareArray.js] includes: [compareArray.js]
features: [Symbol.isConcatSpreadable] features: [Symbol.isConcatSpreadable]
---*/ ---*/
var args = (function(a, b, c) { return arguments; })(1,2,3); var args = (function(a, b, c) {
return arguments;
})(1, 2, 3);
args[Symbol.isConcatSpreadable] = true; args[Symbol.isConcatSpreadable] = true;
assert(compareArray([].concat(args, args), [1, 2, 3, 1, 2, 3])); assert(compareArray([].concat(args, args), [1, 2, 3, 1, 2, 3]));
Object.defineProperty(args, "length", { value: 6 }); Object.defineProperty(args, "length", {
value: 6
});
assert(compareArray([].concat(args), [1, 2, 3, void 0, void 0, void 0])); assert(compareArray([].concat(args), [1, 2, 3, void 0, void 0, void 0]));

View File

@ -31,7 +31,9 @@ function concatTypedArray(type, elems, modulo) {
var expected = new Array(4000); var expected = new Array(4000);
expected[0] = defValue; expected[0] = defValue;
Object.defineProperty(ta, "length", { value: 4000 }); Object.defineProperty(ta, "length", {
value: 4000
});
ta[Symbol.isConcatSpreadable] = true; ta[Symbol.isConcatSpreadable] = true;
assert(compareArray([].concat(ta), expected)); assert(compareArray([].concat(ta), expected));
} }

View File

@ -27,7 +27,7 @@ Boolean.prototype[0] = 1;
Boolean.prototype[1] = 2; Boolean.prototype[1] = 2;
Boolean.prototype[2] = 3; Boolean.prototype[2] = 3;
Boolean.prototype.length = 3; Boolean.prototype.length = 3;
assert(compareArray([1,2,3], [].concat(new Boolean(true)))); assert(compareArray([1, 2, 3], [].concat(new Boolean(true))));
// Boolean values are never concat-spreadable // Boolean values are never concat-spreadable
assert(compareArray([true], [].concat(true))); assert(compareArray([true], [].concat(true)));

View File

@ -21,11 +21,11 @@ assert(compareArray([1, 2, 3], [].concat(fn)));
Function.prototype[Symbol.isConcatSpreadable] = true; Function.prototype[Symbol.isConcatSpreadable] = true;
// Functions may be concat-spreadable // Functions may be concat-spreadable
assert(compareArray([void 0, void 0, void 0], [].concat(function(a,b,c) {}))); assert(compareArray([void 0, void 0, void 0], [].concat(function(a, b, c) {})));
Function.prototype[0] = 1; Function.prototype[0] = 1;
Function.prototype[1] = 2; Function.prototype[1] = 2;
Function.prototype[2] = 3; Function.prototype[2] = 3;
assert(compareArray([1,2,3], [].concat(function(a, b, c) {}))); assert(compareArray([1, 2, 3], [].concat(function(a, b, c) {})));
delete Function.prototype[Symbol.isConcatSpreadable]; delete Function.prototype[Symbol.isConcatSpreadable];
delete Function.prototype[0]; delete Function.prototype[0];

View File

@ -12,7 +12,9 @@ features: [Symbol.isConcatSpreadable]
function MyError() {} function MyError() {}
var obj = {}; var obj = {};
Object.defineProperty(obj, Symbol.isConcatSpreadable, { Object.defineProperty(obj, Symbol.isConcatSpreadable, {
get: function() { throw new MyError(); } get: function() {
throw new MyError();
}
}); });
assert.throws(MyError, function() { assert.throws(MyError, function() {

View File

@ -27,7 +27,7 @@ Number.prototype[0] = 1;
Number.prototype[1] = 2; Number.prototype[1] = 2;
Number.prototype[2] = 3; Number.prototype[2] = 3;
Number.prototype.length = 3; Number.prototype.length = 3;
assert(compareArray([1,2,3], [].concat(new Number(123)))); assert(compareArray([1, 2, 3], [].concat(new Number(123))));
// Number values are never concat-spreadable // Number values are never concat-spreadable
assert(compareArray([true], [].concat(true))); assert(compareArray([true], [].concat(true)));

View File

@ -27,7 +27,7 @@ assert(compareArray([].concat(/abc/), [void 0, void 0, void 0]));
RegExp.prototype[0] = 1; RegExp.prototype[0] = 1;
RegExp.prototype[1] = 2; RegExp.prototype[1] = 2;
RegExp.prototype[2] = 3; RegExp.prototype[2] = 3;
assert(compareArray([].concat(/abc/), [1,2,3])); assert(compareArray([].concat(/abc/), [1, 2, 3]));
delete RegExp.prototype[Symbol.isConcatSpreadable]; delete RegExp.prototype[Symbol.isConcatSpreadable];
delete RegExp.prototype[0]; delete RegExp.prototype[0];

View File

@ -10,7 +10,9 @@ description: Array.prototype.concat Symbol.isConcatSpreadable sparse object
includes: [compareArray.js] includes: [compareArray.js]
features: [Symbol.isConcatSpreadable] features: [Symbol.isConcatSpreadable]
---*/ ---*/
var obj = { length: 5 }; var obj = {
length: 5
};
obj[Symbol.isConcatSpreadable] = true; obj[Symbol.isConcatSpreadable] = true;
assert(compareArray([void 0, void 0, void 0, void 0, void 0], [].concat(obj))); assert(compareArray([void 0, void 0, void 0, void 0, void 0], [].concat(obj)));

View File

@ -10,9 +10,14 @@ description: Array.prototype.concat strict arguments
includes: [compareArray.js] includes: [compareArray.js]
features: [Symbol.isConcatSpreadable] features: [Symbol.isConcatSpreadable]
---*/ ---*/
var args = (function(a, b, c) { "use strict"; return arguments; })(1,2,3); var args = (function(a, b, c) {
"use strict";
return arguments;
})(1, 2, 3);
args[Symbol.isConcatSpreadable] = true; args[Symbol.isConcatSpreadable] = true;
assert(compareArray([].concat(args, args), [1, 2, 3, 1, 2, 3])); assert(compareArray([].concat(args, args), [1, 2, 3, 1, 2, 3]));
Object.defineProperty(args, "length", { value: 6 }); Object.defineProperty(args, "length", {
value: 6
});
assert(compareArray([].concat(args), [1, 2, 3, void 0, void 0, void 0])); assert(compareArray([].concat(args), [1, 2, 3, void 0, void 0, void 0]));

View File

@ -12,9 +12,9 @@ description: Checking this algorithm, items are Array object
---*/ ---*/
var x = new Array(); var x = new Array();
var y = new Array(0,1); var y = new Array(0, 1);
var z = new Array(2,3,4); var z = new Array(2, 3, 4);
var arr = x.concat(y,z); var arr = x.concat(y, z);
//CHECK#0 //CHECK#0
arr.getClass = Object.prototype.toString; arr.getClass = Object.prototype.toString;

View File

@ -13,8 +13,8 @@ description: Checking this algorithm, items are objects and primitives
var x = [0]; var x = [0];
var y = new Object(); var y = new Object();
var z = new Array(1,2); var z = new Array(1, 2);
var arr = x.concat(y,z, -1, true, "NaN"); var arr = x.concat(y, z, -1, true, "NaN");
//CHECK#0 //CHECK#0
arr.getClass = Object.prototype.toString; arr.getClass = Object.prototype.toString;

View File

@ -11,7 +11,7 @@ es5id: 15.4.4.4_A1_T3
description: Checking this algorithm with no items description: Checking this algorithm with no items
---*/ ---*/
var x = [0,1]; var x = [0, 1];
var arr = x.concat(); var arr = x.concat();
//CHECK#0 //CHECK#0

View File

@ -11,8 +11,8 @@ es5id: 15.4.4.4_A1_T4
description: Checking this algorithm, items are [], [,] description: Checking this algorithm, items are [], [,]
---*/ ---*/
var x = [,1]; var x = [, 1];
var arr = x.concat([], [,]); var arr = x.concat([], [, ]);
//CHECK#0 //CHECK#0
arr.getClass = Object.prototype.toString; arr.getClass = Object.prototype.toString;

View File

@ -13,8 +13,8 @@ description: Checking this for Object object, items are objects and primitives
var x = {}; var x = {};
x.concat = Array.prototype.concat; x.concat = Array.prototype.concat;
var y = new Object(); var y = new Object();
var z = new Array(1,2); var z = new Array(1, 2);
var arr = x.concat(y,z, -1, true, "NaN"); var arr = x.concat(y, z, -1, true, "NaN");
//CHECK#0 //CHECK#0
arr.getClass = Object.prototype.toString; arr.getClass = Object.prototype.toString;

View File

@ -33,7 +33,9 @@ if (arr.hasOwnProperty('1') !== true) {
Object.prototype[1] = 1; Object.prototype[1] = 1;
Object.prototype.length = 2; Object.prototype.length = 2;
Object.prototype.concat = Array.prototype.concat; Object.prototype.concat = Array.prototype.concat;
x = {0:0}; x = {
0: 0
};
var arr = x.concat(); var arr = x.concat();
//CHECK#4 //CHECK#4

View File

@ -62,4 +62,3 @@ if (b.hasOwnProperty('1') !== false) {
if (b.hasOwnProperty('2') !== true) { if (b.hasOwnProperty('2') !== true) {
$ERROR("expected b.hasOwnProperty('2') === true, actually " + b.hasOwnProperty('2')); $ERROR("expected b.hasOwnProperty('2') === true, actually " + b.hasOwnProperty('2'));
} }

View File

@ -62,4 +62,3 @@ if (b.hasOwnProperty('1') !== false) {
if (b.hasOwnProperty('2') !== true) { if (b.hasOwnProperty('2') !== true) {
$ERROR("expected b.hasOwnProperty('2') === true, actually " + b.hasOwnProperty('2')); $ERROR("expected b.hasOwnProperty('2') === true, actually " + b.hasOwnProperty('2'));
} }

View File

@ -15,7 +15,9 @@ info: |
4. If isArray is false, return ? ArrayCreate(length). 4. If isArray is false, return ? ArrayCreate(length).
---*/ ---*/
var obj = { length: 0 }; var obj = {
length: 0
};
var callCount = 0; var callCount = 0;
var result; var result;
Object.defineProperty(obj, 'constructor', { Object.defineProperty(obj, 'constructor', {

View File

@ -17,48 +17,42 @@ includes: [compareArray.js]
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(1, 0, null), [0, 1, 2, 3].copyWithin(1, 0, null), [0, 1, 2, 3]
[0, 1, 2, 3]
), ),
'null value coerced to 0' 'null value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(1, 0, NaN), [0, 1, 2, 3].copyWithin(1, 0, NaN), [0, 1, 2, 3]
[0, 1, 2, 3]
), ),
'NaN value coerced to 0' 'NaN value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(1, 0, false), [0, 1, 2, 3].copyWithin(1, 0, false), [0, 1, 2, 3]
[0, 1, 2, 3]
), ),
'false value coerced to 0' 'false value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(1, 0, true), [0, 1, 2, 3].copyWithin(1, 0, true), [0, 0, 2, 3]
[0, 0, 2, 3]
), ),
'true value coerced to 1' 'true value coerced to 1'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(1, 0, '-2'), [0, 1, 2, 3].copyWithin(1, 0, '-2'), [0, 0, 1, 3]
[0, 0, 1, 3]
), ),
'string "-2" value coerced to integer -2' 'string "-2" value coerced to integer -2'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(1, 0, -2.5), [0, 1, 2, 3].copyWithin(1, 0, -2.5), [0, 0, 1, 3]
[0, 0, 1, 3]
), ),
'float -2.5 value coerced to integer -2' 'float -2.5 value coerced to integer -2'
); );

View File

@ -16,32 +16,28 @@ includes: [compareArray.js]
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(1, undefined), [0, 1, 2, 3].copyWithin(1, undefined), [0, 0, 1, 2]
[0, 0, 1, 2]
), ),
'undefined value coerced to 0' 'undefined value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(1, false), [0, 1, 2, 3].copyWithin(1, false), [0, 0, 1, 2]
[0, 0, 1, 2]
), ),
'false value coerced to 0' 'false value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(1, NaN), [0, 1, 2, 3].copyWithin(1, NaN), [0, 0, 1, 2]
[0, 0, 1, 2]
), ),
'NaN value coerced to 0' 'NaN value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(1, null), [0, 1, 2, 3].copyWithin(1, null), [0, 0, 1, 2]
[0, 0, 1, 2]
), ),
'null value coerced to 0' 'null value coerced to 0'
); );
@ -49,8 +45,7 @@ assert(
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, true), [0, 1, 2, 3].copyWithin(0, true), [1, 2, 3, 3]
[1, 2, 3, 3]
), ),
'true value coerced to 1' 'true value coerced to 1'
); );
@ -58,24 +53,21 @@ assert(
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, '1'), [0, 1, 2, 3].copyWithin(0, '1'), [1, 2, 3, 3]
[1, 2, 3, 3]
), ),
'string "1" value coerced to 1' 'string "1" value coerced to 1'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(1, 0.5), [0, 1, 2, 3].copyWithin(1, 0.5), [0, 0, 1, 2]
[0, 0, 1, 2]
), ),
'0.5 float value coerced to integer 0' '0.5 float value coerced to integer 0'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, 1.5), [0, 1, 2, 3].copyWithin(0, 1.5), [1, 2, 3, 3]
[1, 2, 3, 3]
), ),
'1.5 float value coerced to integer 1' '1.5 float value coerced to integer 1'
); );

View File

@ -16,32 +16,28 @@ includes: [compareArray.js]
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(undefined, 1), [0, 1, 2, 3].copyWithin(undefined, 1), [1, 2, 3, 3]
[1, 2, 3, 3]
), ),
'undefined value coerced to 0' 'undefined value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(false, 1), [0, 1, 2, 3].copyWithin(false, 1), [1, 2, 3, 3]
[1, 2, 3, 3]
), ),
'false value coerced to 0' 'false value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(NaN, 1), [0, 1, 2, 3].copyWithin(NaN, 1), [1, 2, 3, 3]
[1, 2, 3, 3]
), ),
'NaN value coerced to 0' 'NaN value coerced to 0'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(null, 1), [0, 1, 2, 3].copyWithin(null, 1), [1, 2, 3, 3]
[1, 2, 3, 3]
), ),
'null value coerced to 0' 'null value coerced to 0'
); );
@ -49,8 +45,7 @@ assert(
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(true, 0), [0, 1, 2, 3].copyWithin(true, 0), [0, 0, 1, 2]
[0, 0, 1, 2]
), ),
'true value coerced to 1' 'true value coerced to 1'
); );
@ -58,24 +53,21 @@ assert(
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin('1', 0), [0, 1, 2, 3].copyWithin('1', 0), [0, 0, 1, 2]
[0, 0, 1, 2]
), ),
'string "1" value coerced to 1' 'string "1" value coerced to 1'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0.5, 1), [0, 1, 2, 3].copyWithin(0.5, 1), [1, 2, 3, 3]
[1, 2, 3, 3]
), ),
'0.5 float value coerced to integer 0' '0.5 float value coerced to integer 0'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(1.5, 0), [0, 1, 2, 3].copyWithin(1.5, 0), [0, 0, 1, 2]
[0, 0, 1, 2]
), ),
'1.5 float value coerced to integer 1' '1.5 float value coerced to integer 1'
); );

View File

@ -20,64 +20,56 @@ includes: [compareArray.js]
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, 1, -1), [0, 1, 2, 3].copyWithin(0, 1, -1), [1, 2, 2, 3]
[1, 2, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 1, -1) -> [1, 2, 2, 3]' '[0, 1, 2, 3].copyWithin(0, 1, -1) -> [1, 2, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4].copyWithin(2, 0, -1), [0, 1, 2, 3, 4].copyWithin(2, 0, -1), [0, 1, 0, 1, 2]
[0, 1, 0, 1, 2]
), ),
'[0, 1, 2, 3, 4].copyWithin(2, 0, -1) -> [0, 1, 0, 1, 2]' '[0, 1, 2, 3, 4].copyWithin(2, 0, -1) -> [0, 1, 0, 1, 2]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4].copyWithin(1, 2, -2), [0, 1, 2, 3, 4].copyWithin(1, 2, -2), [0, 2, 2, 3, 4]
[0, 2, 2, 3, 4]
), ),
'[0, 1, 2, 3, 4].copyWithin(1, 2, -2) -> [0, 2, 2, 3, 4]' '[0, 1, 2, 3, 4].copyWithin(1, 2, -2) -> [0, 2, 2, 3, 4]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, -2, -1), [0, 1, 2, 3].copyWithin(0, -2, -1), [2, 1, 2, 3]
[2, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, -2, -1) -> [2, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, -2, -1) -> [2, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4].copyWithin(2, -2, -1), [0, 1, 2, 3, 4].copyWithin(2, -2, -1), [0, 1, 3, 3, 4]
[0, 1, 3, 3, 4]
), ),
'[0, 1, 2, 3, 4].copyWithin(2, -2, 1) -> [0, 1, 3, 3, 4]' '[0, 1, 2, 3, 4].copyWithin(2, -2, 1) -> [0, 1, 3, 3, 4]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(-3, -2, -1), [0, 1, 2, 3].copyWithin(-3, -2, -1), [0, 2, 2, 3]
[0, 2, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(-3, -2, -1) -> [0, 2, 2, 3]' '[0, 1, 2, 3].copyWithin(-3, -2, -1) -> [0, 2, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4].copyWithin(-2, -3, -1), [0, 1, 2, 3, 4].copyWithin(-2, -3, -1), [0, 1, 2, 2, 3]
[0, 1, 2, 2, 3]
), ),
'[0, 1, 2, 3, 4].copyWithin(-2, -3, -1) -> [0, 1, 2, 2, 3]' '[0, 1, 2, 3, 4].copyWithin(-2, -3, -1) -> [0, 1, 2, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4].copyWithin(-5, -2, -1), [0, 1, 2, 3, 4].copyWithin(-5, -2, -1), [3, 1, 2, 3, 4]
[3, 1, 2, 3, 4]
), ),
'[0, 1, 2, 3, 4].copyWithin(-5, -2, -1) -> [3, 1, 2, 3, 4]' '[0, 1, 2, 3, 4].copyWithin(-5, -2, -1) -> [3, 1, 2, 3, 4]'
); );

View File

@ -20,80 +20,70 @@ includes: [compareArray.js]
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, 1, -10), [0, 1, 2, 3].copyWithin(0, 1, -10), [0, 1, 2, 3]
[0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 1, -10) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, 1, -10) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[1, 2, 3, 4, 5].copyWithin(0, 1, -Infinity), [1, 2, 3, 4, 5].copyWithin(0, 1, -Infinity), [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(0, 1, -Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(0, 1, -Infinity) -> [1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, -2, -10), [0, 1, 2, 3].copyWithin(0, -2, -10), [0, 1, 2, 3]
[0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, -2, -10) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, -2, -10) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[1, 2, 3, 4, 5].copyWithin(0, -2, -Infinity), [1, 2, 3, 4, 5].copyWithin(0, -2, -Infinity), [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(0, -2, -Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(0, -2, -Infinity) -> [1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, -9, -10), [0, 1, 2, 3].copyWithin(0, -9, -10), [0, 1, 2, 3]
[0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, -9, -10) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, -9, -10) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[1, 2, 3, 4, 5].copyWithin(0, -9, -Infinity), [1, 2, 3, 4, 5].copyWithin(0, -9, -Infinity), [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(0, -9, -Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(0, -9, -Infinity) -> [1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(-3, -2, -10), [0, 1, 2, 3].copyWithin(-3, -2, -10), [0, 1, 2, 3]
[0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(-3, -2, -10) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(-3, -2, -10) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[1, 2, 3, 4, 5].copyWithin(-3, -2, -Infinity), [1, 2, 3, 4, 5].copyWithin(-3, -2, -Infinity), [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(-3, -2, -Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(-3, -2, -Infinity) -> [1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(-7, -8, -9), [0, 1, 2, 3].copyWithin(-7, -8, -9), [0, 1, 2, 3]
[0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(-7, -8, -9) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(-7, -8, -9) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity), [1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity), [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity) -> [1, 2, 3, 4, 5]'
); );

View File

@ -17,32 +17,28 @@ includes: [compareArray.js]
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, -10), [0, 1, 2, 3].copyWithin(0, -10), [0, 1, 2, 3]
[0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, -10) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, -10) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[1, 2, 3, 4, 5].copyWithin(0, -Infinity), [1, 2, 3, 4, 5].copyWithin(0, -Infinity), [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(0, -Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(0, -Infinity) -> [1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4].copyWithin(2, -10), [0, 1, 2, 3, 4].copyWithin(2, -10), [0, 1, 0, 1, 2]
[0, 1, 0, 1, 2]
), ),
'[0, 1, 2, 3, 4].copyWithin(2, -2) -> [0, 1, 0, 1, 2]' '[0, 1, 2, 3, 4].copyWithin(2, -2) -> [0, 1, 0, 1, 2]'
); );
assert( assert(
compareArray( compareArray(
[1, 2, 3, 4, 5].copyWithin(2, -Infinity), [1, 2, 3, 4, 5].copyWithin(2, -Infinity), [1, 2, 1, 2, 3]
[1, 2, 1, 2, 3]
), ),
'[1, 2, 3, 4, 5].copyWithin(2, -Infinity) -> [1, 2, 1, 2, 3]' '[1, 2, 3, 4, 5].copyWithin(2, -Infinity) -> [1, 2, 1, 2, 3]'
); );
@ -50,16 +46,14 @@ assert(
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4].copyWithin(10, -10), [0, 1, 2, 3, 4].copyWithin(10, -10), [0, 1, 2, 3, 4]
[0, 1, 2, 3, 4]
), ),
'[0, 1, 2, 3, 4].copyWithin(10, -10) -> [0, 1, 2, 3, 4]' '[0, 1, 2, 3, 4].copyWithin(10, -10) -> [0, 1, 2, 3, 4]'
); );
assert( assert(
compareArray( compareArray(
[1, 2, 3, 4, 5].copyWithin(10, -Infinity), [1, 2, 3, 4, 5].copyWithin(10, -Infinity), [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(10, -Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(10, -Infinity) -> [1, 2, 3, 4, 5]'
); );
@ -67,16 +61,14 @@ assert(
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(-9, -10), [0, 1, 2, 3].copyWithin(-9, -10), [0, 1, 2, 3]
[0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(-9, -10) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(-9, -10) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[1, 2, 3, 4, 5].copyWithin(-9, -Infinity), [1, 2, 3, 4, 5].copyWithin(-9, -Infinity), [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(-9, -Infinity) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(-9, -Infinity) -> [1, 2, 3, 4, 5]'
); );

View File

@ -17,32 +17,28 @@ includes: [compareArray.js]
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(-10, 0), [0, 1, 2, 3].copyWithin(-10, 0), [0, 1, 2, 3]
[0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(-10, 0) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(-10, 0) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[1, 2, 3, 4, 5].copyWithin(-Infinity, 0), [1, 2, 3, 4, 5].copyWithin(-Infinity, 0), [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(-Infinity, 0) -> [1, 2, 3, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(-Infinity, 0) -> [1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4].copyWithin(-10, 2), [0, 1, 2, 3, 4].copyWithin(-10, 2), [2, 3, 4, 3, 4]
[2, 3, 4, 3, 4]
), ),
'[0, 1, 2, 3, 4].copyWithin(-10, 2) -> [2, 3, 4, 3, 4]' '[0, 1, 2, 3, 4].copyWithin(-10, 2) -> [2, 3, 4, 3, 4]'
); );
assert( assert(
compareArray( compareArray(
[1, 2, 3, 4, 5].copyWithin(-Infinity, 2), [1, 2, 3, 4, 5].copyWithin(-Infinity, 2), [3, 4, 5, 4, 5]
[3, 4, 5, 4, 5]
), ),
'[1, 2, 3, 4, 5].copyWithin(-Infinity, 2) -> [3, 4, 5, 4, 5]' '[1, 2, 3, 4, 5].copyWithin(-Infinity, 2) -> [3, 4, 5, 4, 5]'
); );

View File

@ -17,48 +17,42 @@ includes: [compareArray.js]
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, -1), [0, 1, 2, 3].copyWithin(0, -1), [3, 1, 2, 3]
[3, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, -1) -> [3, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, -1) -> [3, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4].copyWithin(2, -2), [0, 1, 2, 3, 4].copyWithin(2, -2), [0, 1, 3, 4, 4]
[0, 1, 3, 4, 4]
), ),
'[0, 1, 2, 3, 4].copyWithin(2, -2) -> [0, 1, 3, 4, 4]' '[0, 1, 2, 3, 4].copyWithin(2, -2) -> [0, 1, 3, 4, 4]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4].copyWithin(1, -2), [0, 1, 2, 3, 4].copyWithin(1, -2), [0, 3, 4, 3, 4]
[0, 3, 4, 3, 4]
), ),
'[0, 1, 2, 3, 4].copyWithin(1, -2) -> [0, 3, 4, 3, 4]' '[0, 1, 2, 3, 4].copyWithin(1, -2) -> [0, 3, 4, 3, 4]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(-1, -2), [0, 1, 2, 3].copyWithin(-1, -2), [0, 1, 2, 2]
[0, 1, 2, 2]
), ),
'[0, 1, 2, 3].copyWithin(-1, -2) -> [ 0, 1, 2, 2 ]' '[0, 1, 2, 3].copyWithin(-1, -2) -> [ 0, 1, 2, 2 ]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4].copyWithin(-2, -3), [0, 1, 2, 3, 4].copyWithin(-2, -3), [0, 1, 2, 2, 3]
[0, 1, 2, 2, 3]
), ),
'[0, 1, 2, 3, 4].copyWithin(-2, -3) -> [0, 1, 2, 2, 3]' '[0, 1, 2, 3, 4].copyWithin(-2, -3) -> [0, 1, 2, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4].copyWithin(-5, -2), [0, 1, 2, 3, 4].copyWithin(-5, -2), [3, 4, 2, 3, 4]
[3, 4, 2, 3, 4]
), ),
'[0, 1, 2, 3, 4].copyWithin(-5, -2) -> [3, 4, 2, 3, 4]' '[0, 1, 2, 3, 4].copyWithin(-5, -2) -> [3, 4, 2, 3, 4]'
); );

View File

@ -17,24 +17,21 @@ includes: [compareArray.js]
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(-1, 0), [0, 1, 2, 3].copyWithin(-1, 0), [0, 1, 2, 0]
[0, 1, 2, 0]
), ),
'[0, 1, 2, 3].copyWithin(-1, 0) -> [0, 1, 2, 0]' '[0, 1, 2, 3].copyWithin(-1, 0) -> [0, 1, 2, 0]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4].copyWithin(-2, 2), [0, 1, 2, 3, 4].copyWithin(-2, 2), [0, 1, 2, 2, 3]
[0, 1, 2, 2, 3]
), ),
'[0, 1, 2, 3, 4].copyWithin(-2, 2) -> [0, 1, 2, 2, 3]' '[0, 1, 2, 3, 4].copyWithin(-2, 2) -> [0, 1, 2, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(-1, 2), [0, 1, 2, 3].copyWithin(-1, 2), [0, 1, 2, 2]
[0, 1, 2, 2]
), ),
'[0, 1, 2, 3].copyWithin(-1, 2) -> [0, 1, 2, 2]' '[0, 1, 2, 3].copyWithin(-1, 2) -> [0, 1, 2, 2]'
); );

View File

@ -36,32 +36,28 @@ includes: [compareArray.js]
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, 1, 6), [0, 1, 2, 3].copyWithin(0, 1, 6), [1, 2, 3, 3]
[1, 2, 3, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 1, 6) -> [1, 2, 3, 3]' '[0, 1, 2, 3].copyWithin(0, 1, 6) -> [1, 2, 3, 3]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, 1, Infinity), [0, 1, 2, 3].copyWithin(0, 1, Infinity), [1, 2, 3, 3]
[1, 2, 3, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 1, Infinity) -> [1, 2, 3, 3]' '[0, 1, 2, 3].copyWithin(0, 1, Infinity) -> [1, 2, 3, 3]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 6), [0, 1, 2, 3, 4, 5].copyWithin(1, 3, 6), [0, 3, 4, 5, 4, 5]
[0, 3, 4, 5, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 6) -> [0, 3, 4, 5, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 6) -> [0, 3, 4, 5, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(1, 3, Infinity), [0, 1, 2, 3, 4, 5].copyWithin(1, 3, Infinity), [0, 3, 4, 5, 4, 5]
[0, 3, 4, 5, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(1, 3, Infinity) -> [0, 3, 4, 5, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, Infinity) -> [0, 3, 4, 5, 4, 5]'
); );

View File

@ -30,64 +30,56 @@ includes: [compareArray.js]
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(6, 0), [0, 1, 2, 3, 4, 5].copyWithin(6, 0), [0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(6, 0) => [0, 1, 2, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(6, 0) => [0, 1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(7, 0), [0, 1, 2, 3, 4, 5].copyWithin(7, 0), [0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(6, 0) => [0, 1, 2, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(6, 0) => [0, 1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(Infinity, 0), [0, 1, 2, 3, 4, 5].copyWithin(Infinity, 0), [0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(Infinity, 0) => [0, 1, 2, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(Infinity, 0) => [0, 1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(6, 2), [0, 1, 2, 3, 4, 5].copyWithin(6, 2), [0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(6, 2) => [0, 1, 2, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(6, 2) => [0, 1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(7, 2), [0, 1, 2, 3, 4, 5].copyWithin(7, 2), [0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(7, 2) => [0, 1, 2, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(7, 2) => [0, 1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(Infinity, 2), [0, 1, 2, 3, 4, 5].copyWithin(Infinity, 2), [0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(Infinity, 2) => [0, 1, 2, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(Infinity, 2) => [0, 1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(0, 6), [0, 1, 2, 3, 4, 5].copyWithin(0, 6), [0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(0, 6) => [0, 1, 2, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(0, 6) => [0, 1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(0, 7), [0, 1, 2, 3, 4, 5].copyWithin(0, 7), [0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(0, 7) => [0, 1, 2, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(0, 7) => [0, 1, 2, 3, 4, 5]'
); );
@ -95,24 +87,21 @@ assert(
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(0, Infinity), [0, 1, 2, 3, 4, 5].copyWithin(0, Infinity), [0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(0, Infinity) => [0, 1, 2, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(0, Infinity) => [0, 1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(2, 6), [0, 1, 2, 3, 4, 5].copyWithin(2, 6), [0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(2, 6) => [0, 1, 2, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(2, 6) => [0, 1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(1, 7), [0, 1, 2, 3, 4, 5].copyWithin(1, 7), [0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(1, 7) => [0, 1, 2, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(1, 7) => [0, 1, 2, 3, 4, 5]'
); );
@ -120,32 +109,28 @@ assert(
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(3, Infinity), [0, 1, 2, 3, 4, 5].copyWithin(3, Infinity), [0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(3, Infinity) => [0, 1, 2, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(3, Infinity) => [0, 1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(6, 6), [0, 1, 2, 3, 4, 5].copyWithin(6, 6), [0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(6, 6) => [0, 1, 2, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(6, 6) => [0, 1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(10, 10), [0, 1, 2, 3, 4, 5].copyWithin(10, 10), [0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(10, 10) => [0, 1, 2, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(10, 10) => [0, 1, 2, 3, 4, 5]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(Infinity, Infinity), [0, 1, 2, 3, 4, 5].copyWithin(Infinity, Infinity), [0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(Infinity, Infinity) => [0, 1, 2, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(Infinity, Infinity) => [0, 1, 2, 3, 4, 5]'
); );

View File

@ -34,28 +34,24 @@ includes: [compareArray.js]
assert( assert(
compareArray( compareArray(
['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(0, 0), ['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(0, 0), ['a', 'b', 'c', 'd', 'e', 'f']
['a', 'b', 'c', 'd', 'e', 'f']
) )
); );
assert( assert(
compareArray( compareArray(
['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(0, 2), ['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(0, 2), ['c', 'd', 'e', 'f', 'e', 'f']
['c', 'd', 'e', 'f', 'e', 'f']
) )
); );
assert( assert(
compareArray( compareArray(
['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(3, 0), ['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(3, 0), ['a', 'b', 'c', 'a', 'b', 'c']
['a', 'b', 'c', 'a', 'b', 'c']
) )
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(1, 4), [0, 1, 2, 3, 4, 5].copyWithin(1, 4), [0, 4, 5, 3, 4, 5]
[0, 4, 5, 3, 4, 5]
) )
); );

View File

@ -36,24 +36,21 @@ includes: [compareArray.js]
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, 0, 0), [0, 1, 2, 3].copyWithin(0, 0, 0), [0, 1, 2, 3]
[0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 0, 0) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, 0, 0) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, 0, 2), [0, 1, 2, 3].copyWithin(0, 0, 2), [0, 1, 2, 3]
[0, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 0, 2) -> [0, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, 0, 2) -> [0, 1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, 1, 2), [0, 1, 2, 3].copyWithin(0, 1, 2), [1, 1, 2, 3]
[1, 1, 2, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 1, 2) -> [1, 1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, 1, 2) -> [1, 1, 2, 3]'
); );
@ -71,16 +68,14 @@ assert(
*/ */
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(1, 0, 2), [0, 1, 2, 3].copyWithin(1, 0, 2), [0, 0, 1, 3]
[0, 0, 1, 3]
), ),
'[0, 1, 2, 3].copyWithin(1, 0, 2) -> [0, 0, 1, 3]' '[0, 1, 2, 3].copyWithin(1, 0, 2) -> [0, 0, 1, 3]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 5), [0, 1, 2, 3, 4, 5].copyWithin(1, 3, 5), [0, 3, 4, 3, 4, 5]
[0, 3, 4, 3, 4, 5]
), ),
'[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 5) -> [0, 3, 4, 3, 4, 5]' '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 5) -> [0, 3, 4, 3, 4, 5]'
); );

View File

@ -23,4 +23,3 @@ var o1 = {
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
[].copyWithin(0, 0, o1); [].copyWithin(0, 0, o1);
}); });

View File

@ -22,4 +22,3 @@ var o1 = {
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
[].copyWithin(0, o1); [].copyWithin(0, o1);
}); });

View File

@ -17,16 +17,14 @@ includes: [compareArray.js]
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, 1, undefined), [0, 1, 2, 3].copyWithin(0, 1, undefined), [1, 2, 3, 3]
[1, 2, 3, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 1, undefined) -> [1, 2, 3]' '[0, 1, 2, 3].copyWithin(0, 1, undefined) -> [1, 2, 3]'
); );
assert( assert(
compareArray( compareArray(
[0, 1, 2, 3].copyWithin(0, 1), [0, 1, 2, 3].copyWithin(0, 1), [1, 2, 3, 3]
[1, 2, 3, 3]
), ),
'[0, 1, 2, 3].copyWithin(0, 1) -> [1, 2, 3, 3]' '[0, 1, 2, 3].copyWithin(0, 1) -> [1, 2, 3, 3]'
); );

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