mirror of
https://github.com/tc39/test262.git
synced 2025-07-16 18:44:38 +02:00
built-ins/Array/*: make all indentation consistent (depth & character) (#1415)
This commit is contained in:
parent
0bf08dff3d
commit
afa24856b4
@ -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');
|
||||||
|
@ -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]');
|
||||||
|
@ -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');
|
||||||
|
@ -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()));
|
||||||
}
|
}
|
||||||
|
@ -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()));
|
||||||
|
@ -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
|
||||||
|
@ -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++) {
|
||||||
|
@ -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()));
|
||||||
}
|
}
|
||||||
|
@ -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()));
|
||||||
|
@ -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
|
||||||
|
@ -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++) {
|
||||||
|
@ -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]));
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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]));
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -10,23 +10,24 @@ es6id: 22.1.2.1
|
|||||||
var arrayIndex = -1;
|
var arrayIndex = -1;
|
||||||
var originalLength = 7;
|
var originalLength = 7;
|
||||||
var obj = {
|
var obj = {
|
||||||
length: originalLength,
|
length: originalLength,
|
||||||
0: 2,
|
0: 2,
|
||||||
1: 4,
|
1: 4,
|
||||||
2: 8,
|
2: 8,
|
||||||
3: 16,
|
3: 16,
|
||||||
4: 32,
|
4: 32,
|
||||||
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) {
|
|
||||||
arrayIndex++;
|
|
||||||
assert.sameValue(value, obj[arrayIndex], "Value mismatch in mapFn at index " + index + ".");
|
|
||||||
assert.sameValue(index, arrayIndex, "Index mismatch in mapFn.");
|
|
||||||
obj[originalLength + arrayIndex] = 2 * arrayIndex + 1;
|
|
||||||
|
|
||||||
return obj[arrayIndex];
|
function mapFn(value, index) {
|
||||||
|
arrayIndex++;
|
||||||
|
assert.sameValue(value, obj[arrayIndex], "Value mismatch in mapFn at index " + index + ".");
|
||||||
|
assert.sameValue(index, arrayIndex, "Index mismatch in mapFn.");
|
||||||
|
obj[originalLength + arrayIndex] = 2 * arrayIndex + 1;
|
||||||
|
|
||||||
|
return obj[arrayIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -34,5 +35,5 @@ var a = Array.from(obj, mapFn);
|
|||||||
assert.sameValue(a.length, array.length, "Length mismatch.");
|
assert.sameValue(a.length, array.length, "Length mismatch.");
|
||||||
|
|
||||||
for (var j = 0; j < a.length; j++) {
|
for (var j = 0; j < a.length; j++) {
|
||||||
assert.sameValue(a[j], array[j], "Element mismatch for array at index " + j + ".");
|
assert.sameValue(a[j], array[j], "Element mismatch for array at index " + j + ".");
|
||||||
}
|
}
|
||||||
|
@ -9,17 +9,18 @@ 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) {
|
|
||||||
this.arrayIndex++;
|
|
||||||
assert.sameValue(value, array[this.arrayIndex], "Value mismatch in mapFn at index " + index + ".");
|
|
||||||
assert.sameValue(index, this.arrayIndex, "Index mismatch in mapFn.");
|
|
||||||
|
|
||||||
array.splice(array.length - 1, 1);
|
function mapFn(value, index) {
|
||||||
return 127;
|
this.arrayIndex++;
|
||||||
|
assert.sameValue(value, array[this.arrayIndex], "Value mismatch in mapFn at index " + index + ".");
|
||||||
|
assert.sameValue(index, this.arrayIndex, "Index mismatch in mapFn.");
|
||||||
|
|
||||||
|
array.splice(array.length - 1, 1);
|
||||||
|
return 127;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -28,5 +29,5 @@ a = Array.from(array, mapFn, this);
|
|||||||
assert.sameValue(a.length, originalArray.length / 2, "Length mismatch. Old array : " + (originalArray.length / 2) + ". array : " + a.length + ".");
|
assert.sameValue(a.length, originalArray.length / 2, "Length mismatch. Old array : " + (originalArray.length / 2) + ". array : " + a.length + ".");
|
||||||
|
|
||||||
for (var j = 0; j < originalArray.length / 2; j++) {
|
for (var j = 0; j < originalArray.length / 2; j++) {
|
||||||
assert.sameValue(a[j], 127, "Element mismatch for mapped array at index " + j + ".");
|
assert.sameValue(a[j], 127, "Element mismatch for mapped array at index " + j + ".");
|
||||||
}
|
}
|
||||||
|
@ -7,21 +7,22 @@ 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) {
|
|
||||||
arrayIndex++;
|
|
||||||
if (index + 1 < array.length) {
|
|
||||||
array[index + 1] = 127;
|
|
||||||
}
|
|
||||||
assert.sameValue(value, 127, "Value mismatch in mapFn at index " + index + ".");
|
|
||||||
assert.sameValue(index, arrayIndex, "Index mismatch in mapFn.");
|
|
||||||
|
|
||||||
return value;
|
function mapFn(value, index) {
|
||||||
|
arrayIndex++;
|
||||||
|
if (index + 1 < array.length) {
|
||||||
|
array[index + 1] = 127;
|
||||||
|
}
|
||||||
|
assert.sameValue(value, 127, "Value mismatch in mapFn at index " + index + ".");
|
||||||
|
assert.sameValue(index, arrayIndex, "Index mismatch in mapFn.");
|
||||||
|
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
var a = Array.from(array, mapFn);
|
var a = Array.from(array, mapFn);
|
||||||
assert.sameValue(a.length, array.length, "Length mismatch.");
|
assert.sameValue(a.length, array.length, "Length mismatch.");
|
||||||
for (var j = 0; j < a.length; j++) {
|
for (var j = 0; j < a.length; j++) {
|
||||||
assert.sameValue(a[j], 127, "Element mismatch for mapped array.");
|
assert.sameValue(a[j], 127, "Element mismatch for mapped array.");
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
@ -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
|
||||||
|
};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
@ -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);
|
||||||
|
});
|
||||||
|
@ -7,14 +7,15 @@ 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) {
|
|
||||||
this.arrayIndex++;
|
|
||||||
assert.sameValue(value, array[this.arrayIndex], "Value mismatch in mapFn at index " + index + ".");
|
|
||||||
assert.sameValue(index, this.arrayIndex, "Index mismatch in mapFn.");
|
|
||||||
|
|
||||||
return value;
|
function mapFn(value, index) {
|
||||||
|
this.arrayIndex++;
|
||||||
|
assert.sameValue(value, array[this.arrayIndex], "Value mismatch in mapFn at index " + index + ".");
|
||||||
|
assert.sameValue(index, this.arrayIndex, "Index mismatch in mapFn.");
|
||||||
|
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
var a = Array.from(array, mapFn, this);
|
var a = Array.from(array, mapFn, this);
|
||||||
|
@ -8,23 +8,25 @@ 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 {
|
||||||
index: 0,
|
index: 0,
|
||||||
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) {
|
||||||
this.isDone = true;
|
this.isDone = true;
|
||||||
}
|
}
|
||||||
return 1 << this.index;
|
return 1 << this.index;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
assert.throws(Test262Error, function(){Array.from(obj);});
|
assert.throws(Test262Error, function() {
|
||||||
|
Array.from(obj);
|
||||||
|
});
|
||||||
|
@ -8,30 +8,30 @@ 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 {
|
||||||
|
index: 0,
|
||||||
|
next() {
|
||||||
return {
|
return {
|
||||||
index: 0,
|
value: this.val,
|
||||||
next() {
|
done: this.isDone
|
||||||
return {
|
|
||||||
value: this.val,
|
|
||||||
done: this.isDone
|
|
||||||
};
|
|
||||||
},
|
|
||||||
isDone : false,
|
|
||||||
get val() {
|
|
||||||
this.index++;
|
|
||||||
if (this.index > 7) {
|
|
||||||
this.isDone = true;
|
|
||||||
}
|
|
||||||
return 1 << this.index;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
|
isDone: false,
|
||||||
|
get val() {
|
||||||
|
this.index++;
|
||||||
|
if (this.index > 7) {
|
||||||
|
this.isDone = true;
|
||||||
|
}
|
||||||
|
return 1 << this.index;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
var a = Array.from.call(Object, obj);
|
var a = Array.from.call(Object, obj);
|
||||||
assert.sameValue(typeof a, typeof {}, "The returned type is expected to be object.");
|
assert.sameValue(typeof a, typeof {}, "The returned type is expected to be object.");
|
||||||
for (var j = 0; j < a.length; j++) {
|
for (var j = 0; j < a.length; j++) {
|
||||||
assert.sameValue(a[j], array[j], "Elements mismatch at " + j + ".");
|
assert.sameValue(a[j], array[j], "Elements mismatch at " + j + ".");
|
||||||
}
|
}
|
||||||
|
@ -12,14 +12,14 @@ 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);
|
||||||
for (var j = 0; j < expectedArray.length; j++) {
|
for (var j = 0; j < expectedArray.length; j++) {
|
||||||
assert.sameValue(a[j], expectedArray[j], "Elements mismatch at " + j + ".");
|
assert.sameValue(a[j], expectedArray[j], "Elements mismatch at " + j + ".");
|
||||||
}
|
}
|
||||||
|
@ -9,14 +9,14 @@ es6id: 22.1.2.1
|
|||||||
|
|
||||||
var array = [2, 4, , 16];
|
var array = [2, 4, , 16];
|
||||||
var obj = {
|
var obj = {
|
||||||
length: 4,
|
length: 4,
|
||||||
0: 2,
|
0: 2,
|
||||||
1: 4,
|
1: 4,
|
||||||
3: 16
|
3: 16
|
||||||
};
|
};
|
||||||
|
|
||||||
var a = Array.from.call(Object, obj);
|
var a = Array.from.call(Object, obj);
|
||||||
assert.sameValue(typeof a, "object", "The returned type is expected to be object.");
|
assert.sameValue(typeof a, "object", "The returned type is expected to be object.");
|
||||||
for (var j = 0; j < a.length; j++) {
|
for (var j = 0; j < a.length; j++) {
|
||||||
assert.sameValue(a[j], array[j], "Elements mismatch at " + j + ".");
|
assert.sameValue(a[j], array[j], "Elements mismatch at " + j + ".");
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,10 @@ es6id: 22.1.2.1
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
var obj = {
|
var obj = {
|
||||||
0: 2,
|
0: 2,
|
||||||
1: 4,
|
1: 4,
|
||||||
2: 8,
|
2: 8,
|
||||||
3: 16
|
3: 16
|
||||||
}
|
}
|
||||||
|
|
||||||
var a = Array.from(obj);
|
var a = Array.from(obj);
|
||||||
|
@ -7,12 +7,12 @@ es5id: 15.4.3.2-0-4
|
|||||||
description: Array.isArray return false if its argument is not an Array
|
description: Array.isArray return false if its argument is not an Array
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var b_num = Array.isArray(42);
|
var b_num = Array.isArray(42);
|
||||||
var b_undef = Array.isArray(undefined);
|
var b_undef = Array.isArray(undefined);
|
||||||
var b_bool = Array.isArray(true);
|
var b_bool = Array.isArray(true);
|
||||||
var b_str = Array.isArray("abc");
|
var b_str = Array.isArray("abc");
|
||||||
var b_obj = Array.isArray({});
|
var b_obj = Array.isArray({});
|
||||||
var b_null = Array.isArray(null);
|
var b_null = Array.isArray(null);
|
||||||
|
|
||||||
|
|
||||||
assert.sameValue(b_num, false, 'b_num');
|
assert.sameValue(b_num, false, 'b_num');
|
||||||
|
@ -10,7 +10,7 @@ description: Array.isArray applied to Arguments object
|
|||||||
var arg;
|
var arg;
|
||||||
|
|
||||||
(function fun() {
|
(function fun() {
|
||||||
arg = arguments;
|
arg = arguments;
|
||||||
}(1, 2, 3));
|
}(1, 2, 3));
|
||||||
|
|
||||||
assert.sameValue(Array.isArray(arg), false, 'Array.isArray(arg)');
|
assert.sameValue(Array.isArray(arg), false, 'Array.isArray(arg)');
|
||||||
|
@ -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 () { })');
|
||||||
|
@ -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();
|
||||||
|
@ -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)');
|
||||||
|
@ -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 })');
|
||||||
|
@ -11,5 +11,5 @@ description: >
|
|||||||
|
|
||||||
|
|
||||||
assert.throws(RangeError, function() {
|
assert.throws(RangeError, function() {
|
||||||
[].length = 4294967296 ;
|
[].length = 4294967296;
|
||||||
});
|
});
|
||||||
|
@ -11,5 +11,5 @@ description: >
|
|||||||
|
|
||||||
|
|
||||||
assert.throws(RangeError, function() {
|
assert.throws(RangeError, function() {
|
||||||
[].length = 4294967297 ;
|
[].length = 4294967297;
|
||||||
});
|
});
|
||||||
|
@ -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');
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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]));
|
||||||
|
@ -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')));
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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');
|
||||||
|
@ -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');
|
||||||
|
@ -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",
|
||||||
|
@ -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), []));
|
||||||
|
@ -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 = [
|
||||||
|
@ -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);
|
||||||
|
@ -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 = [
|
||||||
|
@ -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)));
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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() {
|
||||||
|
@ -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]));
|
||||||
|
@ -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() {
|
||||||
|
@ -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]));
|
||||||
|
@ -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]));
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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)));
|
||||||
|
@ -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];
|
||||||
|
@ -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() {
|
||||||
|
@ -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)));
|
||||||
|
@ -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];
|
||||||
|
@ -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)));
|
||||||
|
|
||||||
|
@ -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]));
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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
|
||||||
|
@ -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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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', {
|
||||||
|
@ -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'
|
||||||
);
|
);
|
||||||
|
@ -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'
|
||||||
);
|
);
|
||||||
|
@ -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'
|
||||||
);
|
);
|
||||||
|
@ -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]'
|
||||||
);
|
);
|
||||||
|
@ -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]'
|
||||||
);
|
);
|
||||||
|
@ -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]'
|
||||||
);
|
);
|
||||||
|
@ -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]'
|
||||||
);
|
);
|
||||||
|
@ -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]'
|
||||||
);
|
);
|
||||||
|
@ -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]'
|
||||||
);
|
);
|
||||||
|
@ -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]'
|
||||||
);
|
);
|
||||||
|
@ -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]'
|
||||||
);
|
);
|
||||||
|
@ -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]
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user