mirror of https://github.com/tc39/test262.git
add esid to array/prototype/pop tests (#1115)
This commit is contained in:
parent
a6a3cf74c4
commit
d6b492205d
|
@ -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.pop
|
||||
es5id: 15.4.4.6_A1.1_T1
|
||||
description: Checking this algorithm
|
||||
---*/
|
||||
|
@ -14,12 +15,12 @@ var x = new Array();
|
|||
var pop = x.pop();
|
||||
if (pop !== undefined) {
|
||||
$ERROR('#1: var x = new Array(); x.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (x.length !== 0) {
|
||||
$ERROR('#2: var x = new Array(); x.pop(); x.length === 0. Actual: ' + (x.length));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
var x = Array(1,2,3);
|
||||
|
@ -27,7 +28,7 @@ x.length = 0;
|
|||
var pop = x.pop();
|
||||
if (pop !== undefined) {
|
||||
$ERROR('#2: var x = Array(1,2,3); x.length = 0; x.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (x.length !== 0) {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: >
|
||||
The last element of the array is removed from the array
|
||||
and returned
|
||||
esid: sec-array.prototype.pop
|
||||
es5id: 15.4.4.6_A1.2_T1
|
||||
description: Checking this use new Array() and []
|
||||
---*/
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: >
|
||||
The pop function is intentionally generic.
|
||||
It does not require that its this value be an Array object
|
||||
esid: sec-array.prototype.pop
|
||||
es5id: 15.4.4.6_A2_T1
|
||||
description: >
|
||||
If ToUint32(length) equal zero, call the [[Put]] method of this
|
||||
|
@ -17,7 +18,7 @@ obj.pop = Array.prototype.pop;
|
|||
if (obj.length !== undefined) {
|
||||
$ERROR('#0: var obj = {}; obj.length === undefined. Actual: ' + (obj.length));
|
||||
} else {
|
||||
//CHECK#1
|
||||
//CHECK#1
|
||||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
$ERROR('#1: var obj = {}; obj.pop = Array.prototype.pop; obj.pop() === undefined. Actual: ' + (pop));
|
||||
|
@ -26,14 +27,14 @@ if (pop !== undefined) {
|
|||
if (obj.length !== 0) {
|
||||
$ERROR('#2: var obj = {}; obj.pop = Array.prototype.pop; obj.pop(); obj.length === 0. Actual: ' + (obj.length));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
obj.length = undefined;
|
||||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
$ERROR('#3: var obj = {}; obj.length = undefined; obj.pop = Array.prototype.pop; obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (obj.length !== 0) {
|
||||
|
@ -45,7 +46,7 @@ obj.length = null
|
|||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
$ERROR('#5: var obj = {}; obj.length = null; obj.pop = Array.prototype.pop; obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
if (obj.length !== 0) {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: >
|
||||
The pop function is intentionally generic.
|
||||
It does not require that its this value be an Array object
|
||||
esid: sec-array.prototype.pop
|
||||
es5id: 15.4.4.6_A2_T2
|
||||
description: >
|
||||
If ToUint32(length) equal zero, call the [[Put]] method of this
|
||||
|
@ -55,7 +56,7 @@ obj.length = -0;
|
|||
var pop = obj.pop();
|
||||
if (pop !== undefined) {
|
||||
$ERROR('#7: var obj = {}; obj.length = -0; obj.pop = Array.prototype.pop; obj.pop() === undefined. Actual: ' + (pop));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#8
|
||||
if (obj.length !== 0) {
|
||||
|
@ -63,8 +64,8 @@ if (obj.length !== 0) {
|
|||
} else {
|
||||
if (1/obj.length !== Number.POSITIVE_INFINITY) {
|
||||
$ERROR('#8: var obj = {}; obj.length = -0; obj.pop = Array.prototype.pop; obj.pop(); obj.length === +0. Actual: ' + (obj.length));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#9
|
||||
obj.length = 0.5;
|
||||
|
@ -76,7 +77,7 @@ if (pop !== undefined) {
|
|||
//CHECK#10
|
||||
if (obj.length !== 0) {
|
||||
$ERROR('#10: var obj = {}; obj.length = 0.5; obj.pop = Array.prototype.pop; obj.pop(); obj.length === 0. Actual: ' + (obj.length));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#11
|
||||
obj.length = new Number(0);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: >
|
||||
The pop function is intentionally generic.
|
||||
It does not require that its this value be an Array object
|
||||
esid: sec-array.prototype.pop
|
||||
es5id: 15.4.4.6_A2_T3
|
||||
description: >
|
||||
The last element ToUint32(length) - 1 of the array is removed from
|
||||
|
@ -24,7 +25,7 @@ if (pop !== undefined) {
|
|||
//CHECK#2
|
||||
if (obj.length !== 1) {
|
||||
$ERROR('#2: var obj = {}; obj.length = 2.5; obj.pop = Array.prototype.pop; obj.pop(); obj.length === 1. Actual: ' + (obj.length));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
obj.length = new Number(2);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
info: >
|
||||
The pop function is intentionally generic.
|
||||
It does not require that its this value be an Array object
|
||||
esid: sec-array.prototype.pop
|
||||
es5id: 15.4.4.6_A2_T4
|
||||
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 pop = obj.pop();
|
||||
if (pop !== -1) {
|
||||
$ERROR('#0: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {return 0}} obj.pop() === -1. Actual: ' + (pop));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
obj[0] = -1;
|
||||
|
@ -39,9 +40,9 @@ if (pop !== -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 pop = obj.pop();
|
||||
if (pop !== -1) {
|
||||
$ERROR('#4.1: obj[0] = -1; obj.length = {valueOf: function() {return 1}, toString: function() {throw "error"}}; obj.pop() === ",". Actual: ' + (pop));
|
||||
|
@ -74,14 +75,14 @@ if (pop !== 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 pop = obj.pop();
|
||||
$ERROR('#7.1: obj[0] = -1; obj.length = {valueOf: function() {throw "error"}, toString: function() {return 0}}; obj.pop() throw "error". Actual: ' + (pop));
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
if (e !== "error") {
|
||||
$ERROR('#7.2: obj[0] = -1; obj.length = {valueOf: function() {throw "error"}, toString: function() {return 0}}; obj.pop() throw "error". Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#8
|
||||
|
@ -90,9 +91,9 @@ try {
|
|||
obj.length = {valueOf: function() {return {}}, toString: function() {return {}}};
|
||||
var pop = obj.pop();
|
||||
$ERROR('#8.1: obj[0] = -1; obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.pop() throw TypeError. Actual: ' + (pop));
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
if ((e instanceof TypeError) !== true) {
|
||||
$ERROR('#8.2: obj[0] = -1; obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.pop() throw TypeError. Actual: ' + (e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
/*---
|
||||
info: Check ToLength(length) for non Array objects
|
||||
esid: sec-array.prototype.pop
|
||||
es5id: 15.4.4.6_A3_T1
|
||||
description: length = 4294967296
|
||||
---*/
|
||||
|
@ -27,7 +28,7 @@ if (obj.length !== 4294967295) {
|
|||
//CHECK#3
|
||||
if (obj[0] !== "x") {
|
||||
$ERROR('#3: var obj = {}; obj.pop = Array.prototype.pop; obj[0] = "x"; obj[4294967295] = "y"; obj.length = 4294967296; obj.pop(); obj[0] === "x". Actual: ' + (obj[0]));
|
||||
}
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (obj[4294967295] !== undefined) {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
/*---
|
||||
info: Check ToLength(length) for non Array objects
|
||||
esid: sec-array.prototype.pop
|
||||
es5id: 15.4.4.6_A3_T2
|
||||
description: length = 4294967297
|
||||
---*/
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
/*---
|
||||
info: Check ToLength(length) for non Array objects
|
||||
esid: sec-array.prototype.pop
|
||||
es5id: 15.4.4.6_A3_T3
|
||||
description: length = -1
|
||||
---*/
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
/*---
|
||||
info: "[[Get]], [[Delete]] from not an inherited property"
|
||||
esid: sec-array.prototype.pop
|
||||
es5id: 15.4.4.6_A4_T1
|
||||
description: >
|
||||
[[Prototype]] of Array instance is Array.prototype, [[Prototype]
|
||||
|
@ -15,13 +16,13 @@ x.length = 2;
|
|||
|
||||
//CHECK#1
|
||||
var pop = x.pop();
|
||||
if (pop !== 1) {
|
||||
$ERROR('#1: Array.prototype[1] = 1; x = [0]; x.length = 2; x.pop() === 1. Actual: ' + (pop));
|
||||
if (pop !== 1) {
|
||||
$ERROR('#1: Array.prototype[1] = 1; x = [0]; x.length = 2; x.pop() === 1. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (x[1] !== 1) {
|
||||
$ERROR('#2: Array.prototype[1] = 1; x = [0]; x.length = 2; x.pop(); x[1] === 1. Actual: ' + (x[1]));
|
||||
if (x[1] !== 1) {
|
||||
$ERROR('#2: Array.prototype[1] = 1; x = [0]; x.length = 2; x.pop(); x[1] === 1. Actual: ' + (x[1]));
|
||||
}
|
||||
|
||||
Object.prototype[1] = 1;
|
||||
|
@ -31,22 +32,22 @@ x = {0:0};
|
|||
|
||||
//CHECK#3
|
||||
var pop = x.pop();
|
||||
if (pop !== 1) {
|
||||
$ERROR('#3: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.pop = Array.prototype.pop; x = {0:0}; x.pop() === 1. Actual: ' + (pop));
|
||||
if (pop !== 1) {
|
||||
$ERROR('#3: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.pop = Array.prototype.pop; x = {0:0}; x.pop() === 1. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (x[1] !== 1) {
|
||||
$ERROR('#4: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.pop = Array.prototype.pop; x = {0:0}; x.pop(); x[1] === 1. Actual: ' + (x[1]));
|
||||
if (x[1] !== 1) {
|
||||
$ERROR('#4: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.pop = Array.prototype.pop; x = {0:0}; x.pop(); x[1] === 1. Actual: ' + (x[1]));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#6: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.pop = Array.prototype.pop; x = {0:0}; x.pop(); x.length === 1. Actual: ' + (x.length));
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#6: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.pop = Array.prototype.pop; x = {0:0}; x.pop(); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
|
||||
//CHECK#7
|
||||
delete x.length;
|
||||
if (x.length !== 2) {
|
||||
$ERROR('#7: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.pop = Array.prototype.pop; x = {0:0}; x.pop(); delete x; x.length === 2. Actual: ' + (x.length));
|
||||
if (x.length !== 2) {
|
||||
$ERROR('#7: Object.prototype[1] = 1; Object.prototype.length = 2; Object.prototype.pop = Array.prototype.pop; x = {0:0}; x.pop(); delete x; x.length === 2. Actual: ' + (x.length));
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
/*---
|
||||
info: "[[Get]], [[Delete]] from not an inherited property"
|
||||
esid: sec-array.prototype.pop
|
||||
es5id: 15.4.4.6_A4_T2
|
||||
description: >
|
||||
[[Prototype]] of Array instance is Array.prototype, [[Prototype]
|
||||
|
@ -15,13 +16,13 @@ x.length = 2;
|
|||
|
||||
//CHECK#1
|
||||
var pop = x.pop();
|
||||
if (pop !== 1) {
|
||||
$ERROR('#1: Array.prototype[1] = -1; x = [0,1]; x.length = 2; x.pop() === 1. Actual: ' + (pop));
|
||||
if (pop !== 1) {
|
||||
$ERROR('#1: Array.prototype[1] = -1; x = [0,1]; x.length = 2; x.pop() === 1. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (x[1] !== -1) {
|
||||
$ERROR('#2: Array.prototype[1] = -1; x = [0,1]; x.length = 2; x.pop(); x[1] === -1. Actual: ' + (x[1]));
|
||||
if (x[1] !== -1) {
|
||||
$ERROR('#2: Array.prototype[1] = -1; x = [0,1]; x.length = 2; x.pop(); x[1] === -1. Actual: ' + (x[1]));
|
||||
}
|
||||
|
||||
Object.prototype[1] = -1;
|
||||
|
@ -31,22 +32,22 @@ x = {0:0,1:1};
|
|||
|
||||
//CHECK#3
|
||||
var pop = x.pop();
|
||||
if (pop !== 1) {
|
||||
$ERROR('#3: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.pop = Array.prototype.pop; x = {0:0,1:1}; x.pop() === 1. Actual: ' + (pop));
|
||||
if (pop !== 1) {
|
||||
$ERROR('#3: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.pop = Array.prototype.pop; x = {0:0,1:1}; x.pop() === 1. Actual: ' + (pop));
|
||||
}
|
||||
|
||||
//CHECK#4
|
||||
if (x[1] !== -1) {
|
||||
$ERROR('#4: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.pop = Array.prototype.pop; x = {0:0,1:1}; x.pop(); x[1] === -1. Actual: ' + (x[1]));
|
||||
if (x[1] !== -1) {
|
||||
$ERROR('#4: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.pop = Array.prototype.pop; x = {0:0,1:1}; x.pop(); x[1] === -1. Actual: ' + (x[1]));
|
||||
}
|
||||
|
||||
//CHECK#6
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#6: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.pop = Array.prototype.pop; x = {0:0,1:1}; x.pop(); x.length === 1. Actual: ' + (x.length));
|
||||
if (x.length !== 1) {
|
||||
$ERROR('#6: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.pop = Array.prototype.pop; x = {0:0,1:1}; x.pop(); x.length === 1. Actual: ' + (x.length));
|
||||
}
|
||||
|
||||
//CHECK#7
|
||||
delete x.length;
|
||||
if (x.length !== 2) {
|
||||
$ERROR('#7: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.pop = Array.prototype.pop; x = {0:0,1:1}; x.pop(); delete x; x.length === 2. Actual: ' + (x.length));
|
||||
if (x.length !== 2) {
|
||||
$ERROR('#7: Object.prototype[1] = -1; Object.prototype.length = 2; Object.prototype.pop = Array.prototype.pop; x = {0:0,1:1}; x.pop(); delete x; x.length === 2. Actual: ' + (x.length));
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
/*---
|
||||
info: The pop property of Array can't be used as constructor
|
||||
esid: sec-array.prototype.pop
|
||||
es5id: 15.4.4.6_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.pop
|
||||
es6id: 22.1.3.16
|
||||
description: >
|
||||
Array.prototype.pop.name is "pop".
|
||||
|
|
Loading…
Reference in New Issue