mirror of https://github.com/tc39/test262.git
add esid to array/prototype/shift tests
This commit is contained in:
parent
a62da2b499
commit
da291ca3b1
|
@ -5,6 +5,7 @@
|
|||
info: >
|
||||
If length equal zero, call the [[Put]] method of this object
|
||||
with arguments "length" and 0 and return undefined
|
||||
esid: sec-array.prototype.shift
|
||||
es5id: 15.4.4.9_A1.1_T1
|
||||
description: Checking this algorithm
|
||||
---*/
|
||||
|
@ -14,12 +15,12 @@ var x = new Array();
|
|||
var shift = x.shift();
|
||||
if (shift !== undefined) {
|
||||
$ERROR('#1: var x = new Array(); x.shift() === undefined. Actual: ' + (shift));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (x.length !== 0) {
|
||||
$ERROR('#2: var x = new Array(); x.shift(); x.length === 0. Actual: ' + (x.length));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
var x = Array(1,2,3);
|
||||
|
@ -27,7 +28,7 @@ x.length = 0;
|
|||
var shift = x.shift();
|
||||
if (shift !== undefined) {
|
||||
$ERROR('#2: var x = Array(1,2,3); x.length = 0; x.shift() === undefined. Actual: ' + (shift));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (x.length !== 0) {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: >
|
||||
The first element of the array is removed from the array and
|
||||
returned
|
||||
esid: sec-array.prototype.shift
|
||||
es5id: 15.4.4.9_A1.2_T1
|
||||
description: Checking this use new Array() and []
|
||||
---*/
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: >
|
||||
The shift function is intentionally generic.
|
||||
It does not require that its this value be an Array object
|
||||
esid: sec-array.prototype.shift
|
||||
es5id: 15.4.4.9_A2_T1
|
||||
description: >
|
||||
If ToUint32(length) equal zero, call the [[Put]] method of this
|
||||
|
@ -17,7 +18,7 @@ obj.shift = Array.prototype.shift;
|
|||
if (obj.length !== undefined) {
|
||||
$ERROR('#0: var obj = {}; obj.length === undefined. Actual: ' + (obj.length));
|
||||
} else {
|
||||
//CHECK#1
|
||||
//CHECK#1
|
||||
var shift = obj.shift();
|
||||
if (shift !== undefined) {
|
||||
$ERROR('#1: var obj = {}; obj.shift = Array.prototype.shift; obj.shift() === undefined. Actual: ' + (shift));
|
||||
|
@ -26,14 +27,14 @@ if (shift !== undefined) {
|
|||
if (obj.length !== 0) {
|
||||
$ERROR('#2: var obj = {}; obj.shift = Array.prototype.shift; obj.shift(); obj.length === 0. Actual: ' + (obj.length));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
obj.length = undefined;
|
||||
var shift = obj.shift();
|
||||
if (shift !== undefined) {
|
||||
$ERROR('#3: var obj = {}; obj.length = undefined; obj.shift = Array.prototype.shift; obj.shift() === undefined. Actual: ' + (shift));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (obj.length !== 0) {
|
||||
|
@ -45,7 +46,7 @@ obj.length = null
|
|||
var shift = obj.shift();
|
||||
if (shift !== undefined) {
|
||||
$ERROR('#5: var obj = {}; obj.length = null; obj.shift = Array.prototype.shift; obj.shift() === undefined. Actual: ' + (shift));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
if (obj.length !== 0) {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: >
|
||||
The shift function is intentionally generic.
|
||||
It does not require that its this value be an Array object
|
||||
esid: sec-array.prototype.shift
|
||||
es5id: 15.4.4.9_A2_T2
|
||||
description: >
|
||||
If ToUint32(length) equal zero, call the [[Put]] method of this
|
||||
|
@ -43,7 +44,7 @@ obj.length = -0;
|
|||
var shift = obj.shift();
|
||||
if (shift !== undefined) {
|
||||
$ERROR('#7: var obj = {}; obj.length = -0; obj.shift = Array.prototype.shift; obj.shift() === undefined. Actual: ' + (shift));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#8
|
||||
if (obj.length !== 0) {
|
||||
|
@ -51,8 +52,8 @@ if (obj.length !== 0) {
|
|||
} else {
|
||||
if (1/obj.length !== Number.POSITIVE_INFINITY) {
|
||||
$ERROR('#8: var obj = {}; obj.length = -0; obj.shift = Array.prototype.shift; obj.shift(); obj.length === +0. Actual: ' + (obj.length));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#9
|
||||
obj.length = 0.5;
|
||||
|
@ -64,7 +65,7 @@ if (shift !== undefined) {
|
|||
//CHECK#10
|
||||
if (obj.length !== 0) {
|
||||
$ERROR('#10: var obj = {}; obj.length = 0.5; obj.shift = Array.prototype.shift; obj.shift(); obj.length === 0. Actual: ' + (obj.length));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#11
|
||||
obj.length = new Number(0);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: >
|
||||
The shift function is intentionally generic.
|
||||
It does not require that its this value be an Array object
|
||||
esid: sec-array.prototype.shift
|
||||
es5id: 15.4.4.9_A2_T3
|
||||
description: >
|
||||
The first element of the array is removed from the array and
|
||||
|
@ -24,7 +25,7 @@ if (shift !== undefined) {
|
|||
//CHECK#2
|
||||
if (obj.length !== 1) {
|
||||
$ERROR('#2: var obj = {}; obj.length = 2.5; obj.shift = Array.prototype.shift; obj.shift(); obj.length === 1. Actual: ' + (obj.length));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
obj.length = new Number(2);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: >
|
||||
The shift function is intentionally generic.
|
||||
It does not require that its this value be an Array object
|
||||
esid: sec-array.prototype.shift
|
||||
es5id: 15.4.4.9_A2_T4
|
||||
description: >
|
||||
The first element of the array is removed from the array and
|
||||
|
@ -21,7 +22,7 @@ obj.length = 4;
|
|||
var shift = obj.shift();
|
||||
if (shift !== 0) {
|
||||
$ERROR('#1: var obj = {}; obj["0"] = 0; obj["3"] = 3; obj.length = 4; obj.shift = Array.prototype.shift; obj.shift() === 0. Actual: ' + (shift));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (obj.length !== 3) {
|
||||
|
@ -32,7 +33,7 @@ if (obj.length !== 3) {
|
|||
var shift = obj.shift();
|
||||
if (shift !== undefined) {
|
||||
$ERROR('#3: var obj = {}; obj["0"] = 0; obj["3"] = 3; obj.length = 4; obj.shift = Array.prototype.shift; obj.shift(); obj.shift() === undefined. Actual: ' + (shift));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (obj.length !== 2) {
|
||||
|
@ -44,7 +45,7 @@ obj.length = 1;
|
|||
var shift = obj.shift();
|
||||
if (shift !== undefined) {
|
||||
$ERROR('#5: var obj = {}; obj["0"] = 0; obj["3"] = 3; obj.length = 4; obj.shift = Array.prototype.shift; obj.shift(); obj.shift(); obj.length = 1; obj.shift() === undefined. Actual: ' + (shift));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
if (obj.length !== 0) {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: >
|
||||
The shift function is intentionally generic.
|
||||
It does not require that its this value be an Array object
|
||||
esid: sec-array.prototype.shift
|
||||
es5id: 15.4.4.9_A2_T5
|
||||
description: >
|
||||
Operator use ToNumber from length. If Type(value) is Object,
|
||||
|
@ -28,7 +29,7 @@ obj.length = {valueOf: function() {return 1}, toString: function() {return 0}};
|
|||
var shift = obj.shift();
|
||||
if (shift !== -1) {
|
||||
$ERROR('#0: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {return 0}} obj.shift() === -1. Actual: ' + (shift));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
obj[0] = -1;
|
||||
|
@ -39,9 +40,9 @@ if (shift !== -1) {
|
|||
}
|
||||
|
||||
//CHECK#4
|
||||
try {
|
||||
try {
|
||||
obj[0] = -1;
|
||||
obj.length = {valueOf: function() {return 1}, toString: function() {throw "error"}};
|
||||
obj.length = {valueOf: function() {return 1}, toString: function() {throw "error"}};
|
||||
var shift = obj.shift();
|
||||
if (shift !== -1) {
|
||||
$ERROR('#4.1: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {throw "error"}}; obj.shift() === ",". Actual: ' + (shift));
|
||||
|
@ -74,14 +75,14 @@ if (shift !== undefined) {
|
|||
//CHECK#7
|
||||
try {
|
||||
obj[0] = -1;
|
||||
obj.length = {valueOf: function() {throw "error"}, toString: function() {return 0}};
|
||||
obj.length = {valueOf: function() {throw "error"}, toString: function() {return 0}};
|
||||
var shift = obj.shift();
|
||||
$ERROR('#7.1: obj[0] = -1; obj.length = {valueOf: function() {throw "error"}, toString: function() {return 0}}; obj.shift() throw "error". Actual: ' + (shift));
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
if (e !== "error") {
|
||||
$ERROR('#7.2: obj[0] = -1; obj.length = {valueOf: function() {throw "error"}, toString: function() {return 0}}; obj.shift() throw "error". Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#8
|
||||
|
@ -90,9 +91,9 @@ try {
|
|||
obj.length = {valueOf: function() {return {}}, toString: function() {return {}}};
|
||||
var shift = obj.shift();
|
||||
$ERROR('#8.1: obj[0] = -1; obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.shift() throw TypeError. Actual: ' + (shift));
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
$ERROR('#8.2: obj[0] = -1; obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.shift() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
/*---
|
||||
info: Check ToLength(length) for non Array objects
|
||||
esid: sec-array.prototype.shift
|
||||
es5id: 15.4.4.9_A3_T3
|
||||
description: length is arbitrarily
|
||||
---*/
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
/*---
|
||||
info: "[[Get]], [[Delete]] from not an inherited property"
|
||||
esid: sec-array.prototype.shift
|
||||
es5id: 15.4.4.9_A4_T1
|
||||
description: >
|
||||
[[Prototype]] of Array instance is Array.prototype, [[Prototype]
|
||||
|
@ -15,18 +16,18 @@ x.length = 2;
|
|||
|
||||
//CHECK#1
|
||||
var shift = x.shift();
|
||||
if (shift !== 0) {
|
||||
$ERROR('#1: Array.prototype[1] = 1; x = [0]; x.length = 2; x.shift() === 0. Actual: ' + (shift));
|
||||
if (shift !== 0) {
|
||||
$ERROR('#1: Array.prototype[1] = 1; x = [0]; x.length = 2; x.shift() === 0. Actual: ' + (shift));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (x[0] !== 1) {
|
||||
$ERROR('#2: Array.prototype[1] = 1; x = [0]; x.length = 2; x.shift(); x[0] === 1. Actual: ' + (x[0]));
|
||||
if (x[0] !== 1) {
|
||||
$ERROR('#2: Array.prototype[1] = 1; x = [0]; x.length = 2; x.shift(); x[0] === 1. Actual: ' + (x[0]));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (x[1] !== 1) {
|
||||
$ERROR('#3: Array.prototype[1] = 1; x = [0]; x.length = 2; x.shift(); x[1] === 1. Actual: ' + (x[1]));
|
||||
if (x[1] !== 1) {
|
||||
$ERROR('#3: Array.prototype[1] = 1; x = [0]; x.length = 2; x.shift(); x[1] === 1. Actual: ' + (x[1]));
|
||||
}
|
||||
|
||||
Object.prototype[1] = 1;
|
||||
|
@ -36,27 +37,27 @@ x = {0:0};
|
|||
|
||||
//CHECK#4
|
||||
var shift = x.shift();
|
||||
if (shift !== 0) {
|
||||
$ERROR('#4: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0}; x.shift() === 0. Actual: ' + (shift));
|
||||
if (shift !== 0) {
|
||||
$ERROR('#4: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0}; x.shift() === 0. Actual: ' + (shift));
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
if (x[0] !== 1) {
|
||||
$ERROR('#5: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0}; x.shift(); x[0] === 1. Actual: ' + (x[0]));
|
||||
if (x[0] !== 1) {
|
||||
$ERROR('#5: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0}; x.shift(); x[0] === 1. Actual: ' + (x[0]));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
if (x[1] !== 1) {
|
||||
$ERROR('#6: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0}; x.shift(); x[1] === 1. Actual: ' + (x[1]));
|
||||
if (x[1] !== 1) {
|
||||
$ERROR('#6: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0}; x.shift(); x[1] === 1. Actual: ' + (x[1]));
|
||||
}
|
||||
|
||||
//CHECK#7
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#7: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0}; x.shift(); x.length === 1. Actual: ' + (x.length));
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#7: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0}; x.shift(); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
|
||||
//CHECK#8
|
||||
delete x.length;
|
||||
if (x.length !== 2) {
|
||||
$ERROR('#8: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0}; x.shift(); delete x; x.length === 2. Actual: ' + (x.length));
|
||||
if (x.length !== 2) {
|
||||
$ERROR('#8: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0}; x.shift(); delete x; x.length === 2. Actual: ' + (x.length));
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
/*---
|
||||
info: "[[Get]], [[Delete]] from not an inherited property"
|
||||
esid: sec-array.prototype.shift
|
||||
es5id: 15.4.4.9_A4_T2
|
||||
description: >
|
||||
[[Prototype]] of Array instance is Array.prototype, [[Prototype]
|
||||
|
@ -15,18 +16,18 @@ x.length = 2;
|
|||
|
||||
//CHECK#1
|
||||
var shift = x.shift();
|
||||
if (shift !== 0) {
|
||||
$ERROR('#1: Array.prototype[1] = -1; x = [0,1]; x.length = 2; x.shift() === 0. Actual: ' + (shift));
|
||||
if (shift !== 0) {
|
||||
$ERROR('#1: Array.prototype[1] = -1; x = [0,1]; x.length = 2; x.shift() === 0. Actual: ' + (shift));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (x[0] !== 1) {
|
||||
$ERROR('#2: Array.prototype[1] = -1; x = [0,1]; x.length = 2; x.shift(); x[0] === 1. Actual: ' + (x[0]));
|
||||
if (x[0] !== 1) {
|
||||
$ERROR('#2: Array.prototype[1] = -1; x = [0,1]; x.length = 2; x.shift(); x[0] === 1. Actual: ' + (x[0]));
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (x[1] !== -1) {
|
||||
$ERROR('#3: Array.prototype[1] = -1; x = [0,1]; x.length = 2; x.shift(); x[1] === -1. Actual: ' + (x[1]));
|
||||
if (x[1] !== -1) {
|
||||
$ERROR('#3: Array.prototype[1] = -1; x = [0,1]; x.length = 2; x.shift(); x[1] === -1. Actual: ' + (x[1]));
|
||||
}
|
||||
|
||||
Object.prototype[1] = -1;
|
||||
|
@ -36,27 +37,27 @@ x = {0:0,1:1};
|
|||
|
||||
//CHECK#4
|
||||
var shift = x.shift();
|
||||
if (shift !== 0) {
|
||||
$ERROR('#4: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0,1:1}; x.shift() === 0. Actual: ' + (shift));
|
||||
if (shift !== 0) {
|
||||
$ERROR('#4: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0,1:1}; x.shift() === 0. Actual: ' + (shift));
|
||||
}
|
||||
|
||||
//CHECK#5
|
||||
if (x[0] !== 1) {
|
||||
$ERROR('#5: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0,1:1}; x.shift(); x[0] === 1. Actual: ' + (x[0]));
|
||||
if (x[0] !== 1) {
|
||||
$ERROR('#5: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0,1:1}; x.shift(); x[0] === 1. Actual: ' + (x[0]));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
if (x[1] !== -1) {
|
||||
$ERROR('#6: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0,1:1}; x.shift(); x[1] === -1. Actual: ' + (x[1]));
|
||||
if (x[1] !== -1) {
|
||||
$ERROR('#6: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0,1:1}; x.shift(); x[1] === -1. Actual: ' + (x[1]));
|
||||
}
|
||||
|
||||
//CHECK#7
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#7: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0,1:1}; x.shift(); x.length === 1. Actual: ' + (x.length));
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#7: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0,1:1}; x.shift(); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
|
||||
//CHECK#8
|
||||
delete x.length;
|
||||
if (x.length !== 2) {
|
||||
$ERROR('#8: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0,1:1}; x.shift(); delete x; x.length === 2. Actual: ' + (x.length));
|
||||
if (x.length !== 2) {
|
||||
$ERROR('#8: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.shift = Array.prototype.shift; x = {0:0,1:1}; x.shift(); delete x; x.length === 2. Actual: ' + (x.length));
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
/*---
|
||||
info: The shift property of Array can't be used as constructor
|
||||
esid: sec-array.prototype.shift
|
||||
es5id: 15.4.4.9_A5.7
|
||||
description: >
|
||||
If property does not implement the internal [[Construct]] method,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-array.prototype.shift
|
||||
es6id: 22.1.3.21
|
||||
description: >
|
||||
Array.prototype.shift.name is "shift".
|
||||
|
|
Loading…
Reference in New Issue