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

@ -11,7 +11,11 @@ description: If Type(value) is Object, evaluate ToPrimitive(value, String)
//CHECK#1
var x = [];
var object = {valueOf: function() {return 1}};
var object = {
valueOf: function() {
return 1
}
};
x[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]"]));
@ -19,7 +23,14 @@ if (x["[object Object]"] !== 0) {
//CHECK#2
x = [];
var object = {valueOf: function() {return 1}, toString: function() {return 0}};
var object = {
valueOf: function() {
return 1
},
toString: function() {
return 0
}
};
x[object] = 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]));
@ -27,7 +38,14 @@ if (x[0] !== 0) {
//CHECK#3
x = [];
var object = {valueOf: function() {return 1}, toString: function() {return {}}};
var object = {
valueOf: function() {
return 1
},
toString: function() {
return {}
}
};
x[object] = 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]));
@ -36,7 +54,14 @@ if (x[1] !== 0) {
//CHECK#4
try {
x = [];
var object = {valueOf: function() {throw "error"}, toString: function() {return 1}};
var object = {
valueOf: function() {
throw "error"
},
toString: function() {
return 1
}
};
x[object] = 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]));
@ -52,7 +77,11 @@ catch (e) {
//CHECK#5
x = [];
var object = {toString: function() {return 1}};
var object = {
toString: function() {
return 1
}
};
x[object] = 0;
if (x[1] !== 0) {
$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
x = [];
var object = {valueOf: function() {return {}}, toString: function() {return 1}}
var object = {
valueOf: function() {
return {}
},
toString: function() {
return 1
}
}
x[object] = 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]));
@ -69,7 +105,14 @@ if (x[1] !== 0) {
//CHECK#7
try {
x = [];
var object = {valueOf: function() {return 1}, toString: function() {throw "error"}};
var object = {
valueOf: function() {
return 1
},
toString: function() {
throw "error"
}
};
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
try {
x = [];
var object = {valueOf: function() {return {}}, toString: function() {return {}}};
var object = {
valueOf: function() {
return {}
},
toString: function() {
return {}
}
};
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;
}
result = Array.from.call(MyCollection, {length: 42});
result = Array.from.call(MyCollection, {
length: 42
});
assert.sameValue(result.args.length, 1);
assert.sameValue(result.args[0], 42);

View File

@ -20,6 +20,7 @@ var obj = {
6: 128
};
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 + ".");

View File

@ -13,6 +13,7 @@ var originalArray = [ 0, 1, -2, 4, -8, 16 ];
var array = [0, 1, -2, 4, -8, 16];
var a = [];
var arrayIndex = -1;
function mapFn(value, index) {
this.arrayIndex++;
assert.sameValue(value, array[this.arrayIndex], "Value mismatch in mapFn at index " + index + ".");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,11 @@ Object.defineProperty(C.prototype, 'length', {
});
items[Symbol.iterator] = function() {
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);
assert.sameValue(result.length, 0);
nextIterResult = { done: false };
lastIterResult = { done: true };
nextIterResult = {
done: false
};
lastIterResult = {
done: true
};
result = Array.from(items);
assert.sameValue(result.length, 1);

View File

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

View File

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

View File

@ -27,4 +27,6 @@ var obj = {
};
}
};
assert.throws(Test262Error, function(){Array.from(obj);});
assert.throws(Test262Error, function() {
Array.from(obj);
});

View File

@ -9,4 +9,8 @@ description: >
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

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

View File

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

View File

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

View File

@ -16,7 +16,12 @@ var obj = {
"5": "C"
};
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 expected = [

View File

@ -9,13 +9,21 @@ description: Array.prototype.concat array like to length throws
features: [Symbol.isConcatSpreadable]
---*/
var obj = {
"length": {valueOf: null, toString: null},
"length": {
valueOf: null,
toString: null
},
"1": "A",
"3": "B",
"5": "C"
};
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"];
assert.throws(TypeError, function() {
Array.prototype.concat.call(obj, obj2, arr);

View File

@ -17,7 +17,12 @@ var obj = {
"5": "C"
};
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 expected = [

View File

@ -10,7 +10,9 @@ description: Array.prototype.concat holey sloppy arguments
includes: [compareArray.js]
features: [Symbol.isConcatSpreadable]
---*/
var args = (function(a) { return arguments; })(1,2,3);
var args = (function(a) {
return arguments;
})(1, 2, 3);
delete args[1];
args[Symbol.isConcatSpreadable] = true;
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);
expected[0] = defValue;
Object.defineProperty(ta, "length", { value: 4000 });
Object.defineProperty(ta, "length", {
value: 4000
});
ta[Symbol.isConcatSpreadable] = true;
assert(compareArray([].concat(ta), expected));
}

View File

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

View File

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

View File

@ -11,9 +11,13 @@ flags: [noStrict]
includes: [compareArray.js]
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;
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]));

View File

@ -10,9 +10,13 @@ description: Array.prototype.concat sloppy arguments
includes: [compareArray.js]
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;
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]));

View File

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

View File

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

View File

@ -10,7 +10,9 @@ description: Array.prototype.concat Symbol.isConcatSpreadable sparse object
includes: [compareArray.js]
features: [Symbol.isConcatSpreadable]
---*/
var obj = { length: 5 };
var obj = {
length: 5
};
obj[Symbol.isConcatSpreadable] = true;
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]
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;
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]));

View File

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

View File

@ -62,4 +62,3 @@ if (b.hasOwnProperty('1') !== false) {
if (b.hasOwnProperty('2') !== true) {
$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) {
$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).
---*/
var obj = { length: 0 };
var obj = {
length: 0
};
var callCount = 0;
var result;
Object.defineProperty(obj, 'constructor', {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,24 +17,21 @@ includes: [compareArray.js]
assert(
compareArray(
[0, 1, 2, 3].copyWithin(-1, 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(
compareArray(
[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]
),
'[0, 1, 2, 3, 4].copyWithin(-2, 2) -> [0, 1, 2, 2, 3]'
);
assert(
compareArray(
[0, 1, 2, 3].copyWithin(-1, 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(
compareArray(
[0, 1, 2, 3].copyWithin(0, 1, 6),
[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(
compareArray(
[0, 1, 2, 3].copyWithin(0, 1, Infinity),
[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(
compareArray(
[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]
),
'[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 6) -> [0, 3, 4, 5, 4, 5]'
);
assert(
compareArray(
[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]
),
'[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(
compareArray(
[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]
),
'[0, 1, 2, 3, 4, 5].copyWithin(6, 0) => [0, 1, 2, 3, 4, 5]'
);
assert(
compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(7, 0),
[0, 1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5].copyWithin(7, 0), [0, 1, 2, 3, 4, 5]
),
'[0, 1, 2, 3, 4, 5].copyWithin(6, 0) => [0, 1, 2, 3, 4, 5]'
);
assert(
compareArray(
[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]
),
'[0, 1, 2, 3, 4, 5].copyWithin(Infinity, 0) => [0, 1, 2, 3, 4, 5]'
);
assert(
compareArray(
[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]
),
'[0, 1, 2, 3, 4, 5].copyWithin(6, 2) => [0, 1, 2, 3, 4, 5]'
);
assert(
compareArray(
[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]
),
'[0, 1, 2, 3, 4, 5].copyWithin(7, 2) => [0, 1, 2, 3, 4, 5]'
);
assert(
compareArray(
[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]
),
'[0, 1, 2, 3, 4, 5].copyWithin(Infinity, 2) => [0, 1, 2, 3, 4, 5]'
);
assert(
compareArray(
[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]
),
'[0, 1, 2, 3, 4, 5].copyWithin(0, 6) => [0, 1, 2, 3, 4, 5]'
);
assert(
compareArray(
[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]
),
'[0, 1, 2, 3, 4, 5].copyWithin(0, 7) => [0, 1, 2, 3, 4, 5]'
);
@ -95,24 +87,21 @@ assert(
assert(
compareArray(
[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]
),
'[0, 1, 2, 3, 4, 5].copyWithin(0, Infinity) => [0, 1, 2, 3, 4, 5]'
);
assert(
compareArray(
[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]
),
'[0, 1, 2, 3, 4, 5].copyWithin(2, 6) => [0, 1, 2, 3, 4, 5]'
);
assert(
compareArray(
[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]
),
'[0, 1, 2, 3, 4, 5].copyWithin(1, 7) => [0, 1, 2, 3, 4, 5]'
);
@ -120,32 +109,28 @@ assert(
assert(
compareArray(
[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]
),
'[0, 1, 2, 3, 4, 5].copyWithin(3, Infinity) => [0, 1, 2, 3, 4, 5]'
);
assert(
compareArray(
[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]
),
'[0, 1, 2, 3, 4, 5].copyWithin(6, 6) => [0, 1, 2, 3, 4, 5]'
);
assert(
compareArray(
[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]
),
'[0, 1, 2, 3, 4, 5].copyWithin(10, 10) => [0, 1, 2, 3, 4, 5]'
);
assert(
compareArray(
[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]
),
'[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(
compareArray(
['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(0, 0),
['a', 'b', 'c', 'd', 'e', 'f']
['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(0, 0), ['a', 'b', 'c', 'd', 'e', 'f']
)
);
assert(
compareArray(
['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(0, 2),
['c', 'd', 'e', 'f', 'e', 'f']
['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(0, 2), ['c', 'd', 'e', 'f', 'e', 'f']
)
);
assert(
compareArray(
['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(3, 0),
['a', 'b', 'c', 'a', 'b', 'c']
['a', 'b', 'c', 'd', 'e', 'f'].copyWithin(3, 0), ['a', 'b', 'c', 'a', 'b', 'c']
)
);
assert(
compareArray(
[0, 1, 2, 3, 4, 5].copyWithin(1, 4),
[0, 4, 5, 3, 4, 5]
[0, 1, 2, 3, 4, 5].copyWithin(1, 4), [0, 4, 5, 3, 4, 5]
)
);

View File

@ -36,24 +36,21 @@ includes: [compareArray.js]
assert(
compareArray(
[0, 1, 2, 3].copyWithin(0, 0, 0),
[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(
compareArray(
[0, 1, 2, 3].copyWithin(0, 0, 2),
[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(
compareArray(
[0, 1, 2, 3].copyWithin(0, 1, 2),
[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(
compareArray(
[0, 1, 2, 3].copyWithin(1, 0, 2),
[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(
compareArray(
[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]
),
'[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() {
[].copyWithin(0, 0, o1);
});

View File

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

View File

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

View File

@ -8,6 +8,7 @@ description: Array.prototype.every applied to Boolean object
---*/
var accessed = false;
function callbackfn(val, idx, obj) {
accessed = true;
return obj instanceof Boolean;

View File

@ -8,6 +8,7 @@ description: Array.prototype.every applied to number primitive
---*/
var accessed = false;
function callbackfn(val, idx, obj) {
accessed = true;
return obj instanceof Number;

View File

@ -8,6 +8,7 @@ description: Array.prototype.every applied to Number object
---*/
var accessed = false;
function callbackfn(val, idx, obj) {
accessed = true;
return obj instanceof Number;

View File

@ -23,7 +23,10 @@ Object.defineProperty(Object.prototype, "length", {
configurable: true
});
var obj = { 0: 9, 1: 8 };
var obj = {
0: 9,
1: 8
};
Object.defineProperty(obj, "length", {
set: function() {},
configurable: true

View File

@ -16,7 +16,10 @@ function callbackfn(val, idx, obj) {
return val > 10;
}
var obj = { 0: 11, 1: 12 };
var obj = {
0: 11,
1: 12
};
assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true');
assert.sameValue(accessed, false, 'accessed');

View File

@ -17,7 +17,9 @@ function callbackfn2(val, idx, obj) {
return val > 11;
}
var proto = { length: 3 };
var proto = {
length: 3
};
var Con = function() {};
Con.prototype = proto;

View File

@ -10,6 +10,7 @@ description: >
---*/
var arrProtoLen = 0;
function callbackfn1(val, idx, obj) {
return val > 10;
}

View File

@ -17,7 +17,9 @@ function callbackfn2(val, idx, obj) {
return val > 11;
}
var proto = { length: 2 };
var proto = {
length: 2
};
var Con = function() {};
Con.prototype = proto;

View File

@ -17,7 +17,9 @@ function callbackfn2(val, idx, obj) {
return val > 11;
}
var proto = { length: 3 };
var proto = {
length: 3
};
var Con = function() {};
Con.prototype = proto;

View File

@ -14,7 +14,10 @@ function callbackfn(val, idx, obj) {
return val > 10;
}
var obj = { 0: 9, length: undefined };
var obj = {
0: 9,
length: undefined
};
assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true');
assert.sameValue(accessed, false, 'accessed');

View File

@ -16,7 +16,10 @@ function callbackfn(val, idx, obj) {
return val > 10;
}
var obj = { 0: 9, length: NaN };
var obj = {
0: 9,
length: NaN
};
assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true');
assert.sameValue(accessed, false, 'accessed');

View File

@ -17,7 +17,12 @@ function callbackfn2(val, idx, obj) {
return val > 11;
}
var obj = { 0: 12, 1: 11, 2: 9, length: "2" };
var obj = {
0: 12,
1: 11,
2: 9,
length: "2"
};
assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true');
assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)');

View File

@ -17,7 +17,12 @@ function callbackfn2(val, idx, obj) {
return val > 11;
}
var obj = { 0: 11, 1: 12, 2: 9, length: "-4294967294" };
var obj = {
0: 11,
1: 12,
2: 9,
length: "-4294967294"
};
assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true');
assert(Array.prototype.every.call(obj, callbackfn2), 'Array.prototype.every.call(obj, callbackfn2) !== true');

View File

@ -17,7 +17,12 @@ function callbackfn2(val, idx, obj) {
return val > 11;
}
var obj = { 0: 12, 1: 11, 2: 9, length: "2.5" };
var obj = {
0: 12,
1: 11,
2: 9,
length: "2.5"
};
assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true');
assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)');

View File

@ -14,9 +14,18 @@ function callbackfn(val, idx, obj) {
return val > 10;
}
var objOne = { 0: 9, length: "Infinity" };
var objTwo = { 0: 9, length: "+Infinity" };
var objThree = { 0: 9, length: "-Infinity" };
var objOne = {
0: 9,
length: "Infinity"
};
var objTwo = {
0: 9,
length: "+Infinity"
};
var objThree = {
0: 9,
length: "-Infinity"
};
assert.sameValue(Array.prototype.every.call(objOne, callbackfn), false, 'Array.prototype.every.call(objOne, callbackfn)');
assert.sameValue(Array.prototype.every.call(objTwo, callbackfn), false, 'Array.prototype.every.call(objTwo, callbackfn)');

View File

@ -17,7 +17,12 @@ function callbackfn2(val, idx, obj) {
return val > 11;
}
var obj = { 0: 12, 1: 11, 2: 9, length: "2E0" };
var obj = {
0: 12,
1: 11,
2: 9,
length: "2E0"
};
assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true');
assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)');

View File

@ -17,7 +17,12 @@ function callbackfn2(val, idx, obj) {
return val > 11;
}
var obj = { 0: 12, 1: 11, 2: 9, length: "0x0002" };
var obj = {
0: 12,
1: 11,
2: 9,
length: "0x0002"
};
assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true');
assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)');

View File

@ -17,7 +17,12 @@ function callbackfn2(val, idx, obj) {
return val > 11;
}
var obj = { 0: 12, 1: 11, 2: 9, length: "0002.00" };
var obj = {
0: 12,
1: 11,
2: 9,
length: "0002.00"
};
assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true');
assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)');

View File

@ -16,7 +16,11 @@ function callbackfn(val, idx, obj) {
return val > 10;
}
var obj = { 0: 9, 1: 8, length: "two" };
var obj = {
0: 9,
1: 8,
length: "two"
};
assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true');
assert.sameValue(accessed, false, 'accessed');

View File

@ -17,7 +17,11 @@ function callbackfn2(val, idx, obj) {
return val > 11;
}
var obj = { 0: 11, 1: 9, length: true };
var obj = {
0: 11,
1: 9,
length: true
};
assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true');
assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)');

View File

@ -17,7 +17,12 @@ description: >
return val > 11;
}
var obj = { 0: 12, 1: 11, 2: 9, length: 2.685 };
var obj = {
0: 12,
1: 11,
2: 9,
length: 2.685
};
assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true');
assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)');

View File

@ -14,7 +14,10 @@ description: Array.prototype.every - value of 'length' is a number (value is 0)
return val > 10;
}
var obj = { 0: 9, length: 0 };
var obj = {
0: 9,
length: 0
};
assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true');
assert.sameValue(accessed, false, 'accessed');

View File

@ -14,7 +14,10 @@ description: Array.prototype.every - value of 'length' is a number (value is +0)
return val > 10;
}
var obj = { 0: 9, length: +0 };
var obj = {
0: 9,
length: +0
};
assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true');
assert.sameValue(accessed, false, 'accessed');

View File

@ -14,7 +14,10 @@ description: Array.prototype.every - value of 'length' is a number (value is -0)
return val > 10;
}
var obj = { 0: 9, length: -0 };
var obj = {
0: 9,
length: -0
};
assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true');
assert.sameValue(accessed, false, 'accessed');

View File

@ -17,7 +17,12 @@ description: >
return val > 11;
}
var obj = { 0: 12, 1: 11, 2: 9, length: 2 };
var obj = {
0: 12,
1: 11,
2: 9,
length: 2
};
assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true');
assert.sameValue(Array.prototype.every.call(obj, callbackfn2), false, 'Array.prototype.every.call(obj, callbackfn2)');

View File

@ -17,7 +17,12 @@ description: >
return val > 11;
}
var obj = { 0: 12, 1: 11, 2: 9, length: -4294967294 }; //length used to exec while loop is 0
var obj = {
0: 12,
1: 11,
2: 9,
length: -4294967294
}; //length used to exec while loop is 0
assert(Array.prototype.every.call(obj, callbackfn1), 'Array.prototype.every.call(obj, callbackfn1) !== true');
assert(Array.prototype.every.call(obj, callbackfn2), 'Array.prototype.every.call(obj, callbackfn2) !== true');

View File

@ -16,7 +16,10 @@ description: >
return val > 10;
}
var obj = { 0: 9, length: Infinity };
var obj = {
0: 9,
length: Infinity
};
assert.sameValue(Array.prototype.every.call(obj, callbackfn), false, 'Array.prototype.every.call(obj, callbackfn)');
assert(accessed, 'accessed !== true');

View File

@ -16,7 +16,10 @@ description: >
return val > 10;
}
var obj = { 0: 9, length: -Infinity };
var obj = {
0: 9,
length: -Infinity
};
assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true');
assert.sameValue(accessed, false, 'accessed');

View File

@ -9,7 +9,10 @@ description: >
was thrown by step 2
---*/
var obj = { 0: 11, 1: 12 };
var obj = {
0: 11,
1: 12
};
Object.defineProperty(obj, "length", {
get: function() {

View File

@ -9,7 +9,10 @@ description: >
was thrown by step 3
---*/
var obj = { 0: 11, 1: 12 };
var obj = {
0: 11,
1: 12
};
Object.defineProperty(obj, "length", {
get: function() {

View File

@ -9,7 +9,9 @@ description: >
passing undefined for callbackfn
---*/
var obj = { 10: 10 };
var obj = {
10: 10
};
var lengthAccessed = false;
var loopAccessed = false;

View File

@ -9,7 +9,10 @@ description: >
visible when an exception occurs
---*/
var obj = { 0: 11, 1: 12 };
var obj = {
0: 11,
1: 12
};
var accessed = false;

View File

@ -9,7 +9,10 @@ description: >
visible when an exception occurs
---*/
var obj = { 0: 11, 1: 12 };
var obj = {
0: 11,
1: 12
};
var accessed = false;

View File

@ -10,6 +10,7 @@ description: Array.prototype.every - thisArg is Object
var res = false;
var o = new Object();
o.res = true;
function callbackfn(val, idx, obj)
{
return this.res;

View File

@ -10,6 +10,7 @@ description: Array.prototype.every - thisArg is Array
var res = false;
var a = new Array();
a.res = true;
function callbackfn(val, idx, obj)
{
return this.res;

View File

@ -10,6 +10,7 @@ description: >
---*/
var res = false;
function callbackfn(val, idx, obj)
{
return this.res;

View File

@ -8,6 +8,7 @@ description: Array.prototype.every - thisArg is object from object template
---*/
var res = false;
function callbackfn(val, idx, obj)
{
return this.res;

View File

@ -8,6 +8,7 @@ description: Array.prototype.every - thisArg is function
---*/
var res = false;
function callbackfn(val, idx, obj)
{
return this.res;

View File

@ -14,7 +14,11 @@ description: Array.prototype.every - no observable effects occur if len is 0
return val > 10;
}
var obj = { 0: 11, 1: 12, length: 0 };
var obj = {
0: 11,
1: 12,
length: 0
};
assert(Array.prototype.every.call(obj, callbackfn), 'Array.prototype.every.call(obj, callbackfn) !== true');
assert.sameValue(accessed, false, 'accessed');

View File

@ -16,7 +16,11 @@ description: >
return val > 10;
}
var obj = { 1: 12, 2: 9, length: 2 };
var obj = {
1: 12,
2: 9,
length: 2
};
Object.defineProperty(obj, "0", {
get: function() {

View File

@ -10,6 +10,7 @@ description: >
---*/
var callCnt = 0.;
function callbackfn(val, Idx, obj)
{
callCnt++;

View File

@ -10,11 +10,15 @@ description: >
---*/
var accessed = false;
function callbackfn(val, idx, obj) {
accessed = true;
return idx !== 1;
}
var arr = { 2: 2, length: 20 };
var arr = {
2: 2,
length: 20
};
Object.defineProperty(arr, "0", {
get: function() {

View File

@ -10,6 +10,7 @@ description: >
---*/
var accessed = false;
function callbackfn(val, idx, obj) {
accessed = true;
return idx !== 1;

View File

@ -17,7 +17,12 @@ description: >
return true;
}
}
var arr = { 0: 0, 1: 111, 2: 2, length: 10 };
var arr = {
0: 0,
1: 111,
2: 2,
length: 10
};
Object.defineProperty(arr, "0", {
get: function() {

View File

@ -10,6 +10,7 @@ description: >
---*/
var accessed = false;
function callbackfn(val, idx, obj) {
accessed = true;
return idx !== 3;

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