add esid to array/prototype/unshift tests

This commit is contained in:
deathbearbrown 2017-06-30 14:25:58 -07:00 committed by Rick Waldron
parent 2d13a07cc1
commit b2737b2d82
10 changed files with 73 additions and 63 deletions

View File

@ -6,6 +6,7 @@ info: >
The arguments are prepended to the start of the array, such that
their order within the array is the same as the order in which they appear in
the argument list
esid: sec-array.prototype.unshift
es5id: 15.4.4.13_A1_T1
description: Checking case when unsift is given no arguments or one argument
---*/
@ -15,7 +16,7 @@ var x = new Array();
var unshift = x.unshift(1);
if (unshift !== 1) {
$ERROR('#1: x = new Array(); x.unshift(1) === 1. Actual: ' + (unshift));
}
}
//CHECK#2
if (x[0] !== 1) {

View File

@ -6,6 +6,7 @@ info: >
The arguments are prepended to the start of the array, such that
their order within the array is the same as the order in which they appear in
the argument list
esid: sec-array.prototype.unshift
es5id: 15.4.4.13_A1_T2
description: Checking case when unsift is given many arguments
---*/
@ -21,7 +22,7 @@ x[0] = 0;
var unshift = x.unshift(true, Number.POSITIVE_INFINITY, "NaN", "1", -1);
if (unshift !== 6) {
$ERROR('#2: x = []; x[0] = 0; x.unshift(true, Number.POSITIVE_INFINITY, "NaN", "1", -1) === 6. Actual: ' + (unshift));
}
}
//CHECK#3
if (x[5] !== 0) {
@ -36,12 +37,12 @@ if (x[0] !== true) {
//CHECK#5
if (x[1] !== Number.POSITIVE_INFINITY) {
$ERROR('#5: x = []; x[0] = 0; x.unshift(true, Number.POSITIVE_INFINITY, "NaN", "1", -1); x[1] === Number.POSITIVE_INFINITY. Actual: ' + (x[1]));
}
}
//CHECK#6
if (x[2] !== "NaN") {
$ERROR('#6: x = []; x[0] = 0; x.unshift(true, Number.POSITIVE_INFINITY, "NaN", "1", -1); x[2] === "NaN". Actual: ' + (x[2]));
}
}
//CHECK#7
if (x[3] !== "1") {

View File

@ -5,6 +5,7 @@
info: >
The unshift function is intentionally generic.
It does not require that its this value be an Array object
esid: sec-array.prototype.unshift
es5id: 15.4.4.13_A2_T1
description: >
The arguments are prepended to the start of the array, such that
@ -19,7 +20,7 @@ if (obj.length !== undefined) {
$ERROR('#0: var obj = {}; obj.length === undefined. Actual: ' + (obj.length));
} else {
//CHECK#1
var unshift = obj.unshift(-1);
var unshift = obj.unshift(-1);
if (unshift !== 1) {
$ERROR('#1: var obj = {}; obj.unshift = Array.prototype.unshift; obj.unshift(-1) === 1. Actual: ' + (unshift));
}
@ -31,14 +32,14 @@ if (obj.length !== undefined) {
if (obj["0"] !== -1) {
$ERROR('#3: var obj = {}; obj.unshift = Array.prototype.unshift; obj.unshift(-1); obj["0"] === -1. Actual: ' + (obj["0"]));
}
}
}
//CHECK#4
obj.length = undefined;
var unshift = obj.unshift(-4);
if (unshift !== 1) {
$ERROR('#4: var obj = {}; obj.length = undefined; obj.unshift = Array.prototype.unshift; obj.unshift(-4) === 1. Actual: ' + (unshift));
}
}
//CHECK#5
if (obj.length !== 1) {
@ -55,7 +56,7 @@ obj.length = null
var unshift = obj.unshift(-7);
if (unshift !== 1) {
$ERROR('#7: var obj = {}; obj.length = null; obj.unshift = Array.prototype.unshift; obj.unshift(-7) === 1. Actual: ' + (unshift));
}
}
//CHECK#8
if (obj.length !== 1) {

View File

@ -5,6 +5,7 @@
info: >
The unshift function is intentionally generic.
It does not require that its this value be an Array object
esid: sec-array.prototype.unshift
es5id: 15.4.4.13_A2_T2
description: >
The arguments are prepended to the start of the array, such that
@ -59,7 +60,7 @@ if (unshift !== 1) {
//CHECK#11
if (obj.length !== 1) {
$ERROR('#11: var obj = {}; obj.length = 0.5; obj.unshift = Array.prototype.unshift; obj.unshift(-10); obj.length === 1. Actual: ' + (obj.length));
}
}
//CHECK#12
if (obj["0"] !== -10) {
@ -76,7 +77,7 @@ if (unshift !== 2) {
//CHECK#14
if (obj.length !== 2) {
$ERROR('#14: var obj = {}; obj.length = 1.5; obj.unshift = Array.prototype.unshift; obj.unshift(-13); obj.length === 2. Actual: ' + (obj.length));
}
}
//CHECK#15
if (obj["0"] !== -13) {

View File

@ -5,6 +5,7 @@
info: >
The unshift function is intentionally generic.
It does not require that its this value be an Array object
esid: sec-array.prototype.unshift
es5id: 15.4.4.13_A2_T3
description: >
Operator use ToNumber from length. If Type(value) is Object,
@ -26,7 +27,7 @@ obj.length = {valueOf: function() {return 3}, toString: function() {return 1}};
var unshift = obj.unshift();
if (unshift !== 3) {
$ERROR('#0: obj.length = {valueOf: function() {return 3}, toString: function() {return 1}} obj.unshift() === 3. Actual: ' + (unshift));
}
}
//CHECK#3
obj.length = {valueOf: function() {return 3}, toString: function() {return {}}};
@ -36,9 +37,9 @@ if (unshift !== 3) {
}
//CHECK#4
try {
try {
obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}};
var unshift = obj.unshift();
var unshift = obj.unshift();
if (unshift !== 3) {
$ERROR('#4.1: obj.length = {valueOf: function() {return 3}, toString: function() {throw "error"}}; obj.unshift() === ",". Actual: ' + (unshift));
}
@ -53,40 +54,40 @@ catch (e) {
//CHECK#5
obj.length = {toString: function() {return 1}};
var unshift = obj.unshift();
var unshift = obj.unshift();
if (unshift !== 1) {
$ERROR('#5: obj.length = {toString: function() {return 1}} obj.unshift() === 1. Actual: ' + (unshift));
}
//CHECK#6
obj.length = {valueOf: function() {return {}}, toString: function() {return 1}}
var unshift = obj.unshift();
var unshift = obj.unshift();
if (unshift !== 1) {
$ERROR('#6: obj.length = {valueOf: function() {return {}}, toString: function() {return 1}} obj.unshift() === 1. Actual: ' + (unshift));
}
//CHECK#7
try {
obj.length = {valueOf: function() {throw "error"}, toString: function() {return 1}};
obj.length = {valueOf: function() {throw "error"}, toString: function() {return 1}};
var unshift = obj.unshift();
$ERROR('#7.1: obj.length = {valueOf: function() {throw "error"}, toString: function() {return 1}}; obj.unshift() throw "error". Actual: ' + (unshift));
}
}
catch (e) {
if (e !== "error") {
$ERROR('#7.2: obj.length = {valueOf: function() {throw "error"}, toString: function() {return 1}}; obj.unshift() throw "error". Actual: ' + (e));
}
}
}
//CHECK#8
try {
obj.length = {valueOf: function() {return {}}, toString: function() {return {}}};
var unshift = obj.unshift();
$ERROR('#8.1: obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.unshift() throw TypeError. Actual: ' + (unshift));
}
}
catch (e) {
if ((e instanceof TypeError) !== true) {
$ERROR('#8.2: obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.unshift() throw TypeError. Actual: ' + (e));
}
}
}

View File

@ -3,6 +3,7 @@
/*---
info: Check ToLength(length) for non Array objects
esid: sec-array.prototype.unshift
es5id: 15.4.4.13_A3_T2
description: length = -4294967295
---*/
@ -31,7 +32,7 @@ if (obj[0] !== "x") {
//CHECK#4
if (obj[1] !== "y") {
$ERROR('#4: var obj = {}; obj.unshift = Array.prototype.unshift; obj[0] = ""; obj.length = -4294967295; obj.unshift("x", "y", "z"); obj[1] === "y". Actual: ' + (obj[1]));
}
}
//CHECK#5
if (obj[2] !== "z") {

View File

@ -3,6 +3,7 @@
/*---
info: "[[Get]], [[Delete]] from not an inherited property"
esid: sec-array.prototype.unshift
es5id: 15.4.4.13_A4_T1
description: >
[[Prototype]] of Array instance is Array.prototype, [[Prototype]
@ -15,25 +16,25 @@ x.length = 1;
//CHECK#1
var unshift = x.unshift(0);
if (unshift !== 2) {
$ERROR('#1: Array.prototype[0] = -1; x = [1]; x.length = 1; x.unshift(0) === 2. Actual: ' + (unshift));
if (unshift !== 2) {
$ERROR('#1: Array.prototype[0] = -1; x = [1]; x.length = 1; x.unshift(0) === 2. Actual: ' + (unshift));
}
//CHECK#2
if (x[0] !== 0) {
$ERROR('#2: Array.prototype[0] = -1; x = [1]; x.length = 1; x.unshift(0); x[0] === 0. Actual: ' + (x[0]));
if (x[0] !== 0) {
$ERROR('#2: Array.prototype[0] = -1; x = [1]; x.length = 1; x.unshift(0); x[0] === 0. Actual: ' + (x[0]));
}
//CHECK#3
if (x[1] !== 1) {
$ERROR('#3: Array.prototype[0] = -1; x = [1]; x.length = 1; x.unshift(0); x[1] === 1. Actual: ' + (x[1]));
if (x[1] !== 1) {
$ERROR('#3: Array.prototype[0] = -1; x = [1]; x.length = 1; x.unshift(0); x[1] === 1. Actual: ' + (x[1]));
}
delete x[0];
//CHECK#4
if (x[0] !== -1) {
$ERROR('#4: Array.prototype[0] = -1; x = [1]; x.length = 1; x.unshift(0); delete x[0]; x[0] === -1. Actual: ' + (x[0]));
if (x[0] !== -1) {
$ERROR('#4: Array.prototype[0] = -1; x = [1]; x.length = 1; x.unshift(0); delete x[0]; x[0] === -1. Actual: ' + (x[0]));
}
Object.prototype[0] = -1;
@ -43,34 +44,34 @@ x = {0:1};
//CHECK#5
var unshift = x.unshift(0);
if (unshift !== 2) {
$ERROR('#5: Object.prototype[0] = -1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {0:0}; x.unshift(0) === 2. Actual: ' + (unshift));
if (unshift !== 2) {
$ERROR('#5: Object.prototype[0] = -1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {0:0}; x.unshift(0) === 2. Actual: ' + (unshift));
}
//CHECK#6
if (x[0] !== 0) {
$ERROR('#6: Object.prototype[0] = -1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {0:0}; x.unshift(0); x[0] === 0. Actual: ' + (x[0]));
if (x[0] !== 0) {
$ERROR('#6: Object.prototype[0] = -1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {0:0}; x.unshift(0); x[0] === 0. Actual: ' + (x[0]));
}
//CHECK#7
if (x[1] !== 1) {
$ERROR('#7: Object.prototype[0] = -1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {0:0}; x.unshift(0); x[1] === 1. Actual: ' + (x[1]));
if (x[1] !== 1) {
$ERROR('#7: Object.prototype[0] = -1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {0:0}; x.unshift(0); x[1] === 1. Actual: ' + (x[1]));
}
delete x[0];
//CHECK#8
if (x[0] !== -1) {
$ERROR('#8: Object.prototype[0] = -1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {0:0}; x.unshift(0); delete x[0]; x[0] === -1. Actual: ' + (x[0]));
if (x[0] !== -1) {
$ERROR('#8: Object.prototype[0] = -1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {0:0}; x.unshift(0); delete x[0]; x[0] === -1. Actual: ' + (x[0]));
}
//CHECK#9
if (x.length !== 2) {
$ERROR('#9: Object.prototype[0] = -1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {0:0}; x.unshift(0); x.length === 1. Actual: ' + (x.length));
if (x.length !== 2) {
$ERROR('#9: Object.prototype[0] = -1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {0:0}; x.unshift(0); x.length === 1. Actual: ' + (x.length));
}
//CHECK#10
delete x.length;
if (x.length !== 1) {
$ERROR('#10: Object.prototype[1] = -1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {0:0}; x.unshift(0); delete x; x.length === 1. Actual: ' + (x.length));
if (x.length !== 1) {
$ERROR('#10: Object.prototype[1] = -1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {0:0}; x.unshift(0); delete x; x.length === 1. Actual: ' + (x.length));
}

View File

@ -3,6 +3,7 @@
/*---
info: "[[Get]], [[Delete]] from not an inherited property"
esid: sec-array.prototype.unshift
es5id: 15.4.4.13_A4_T2
description: >
[[Prototype]] of Array instance is Array.prototype, [[Prototype]
@ -15,25 +16,25 @@ x.length = 1;
//CHECK#1
var unshift = x.unshift(0);
if (unshift !== 2) {
$ERROR('#1: Array.prototype[0] = 1; x = []; x.length = 1; x.unshift(0) === 2. Actual: ' + (unshift));
if (unshift !== 2) {
$ERROR('#1: Array.prototype[0] = 1; x = []; x.length = 1; x.unshift(0) === 2. Actual: ' + (unshift));
}
//CHECK#2
if (x[0] !== 0) {
$ERROR('#2: Array.prototype[0] = 1; x = []; x.length = 1; x.unshift(0); x[0] === 0. Actual: ' + (x[0]));
if (x[0] !== 0) {
$ERROR('#2: Array.prototype[0] = 1; x = []; x.length = 1; x.unshift(0); x[0] === 0. Actual: ' + (x[0]));
}
//CHECK#3
if (x[1] !== 1) {
$ERROR('#3: Array.prototype[0] = 1; x = []; x.length = 1; x.unshift(0); x[1] === 1. Actual: ' + (x[1]));
if (x[1] !== 1) {
$ERROR('#3: Array.prototype[0] = 1; x = []; x.length = 1; x.unshift(0); x[1] === 1. Actual: ' + (x[1]));
}
delete x[0];
//CHECK#4
if (x[0] !== 1) {
$ERROR('#4: Array.prototype[0] = 1; x = [1]; x.length = 1; x.unshift(0); delete x[0]; x[0] === 1. Actual: ' + (x[0]));
if (x[0] !== 1) {
$ERROR('#4: Array.prototype[0] = 1; x = [1]; x.length = 1; x.unshift(0); delete x[0]; x[0] === 1. Actual: ' + (x[0]));
}
Object.prototype[0] = 1;
@ -43,34 +44,34 @@ x = {};
//CHECK#5
var unshift = x.unshift(0);
if (unshift !== 2) {
$ERROR('#5: Object.prototype[0] = 1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {}; x.unshift(0) === 2. Actual: ' + (unshift));
if (unshift !== 2) {
$ERROR('#5: Object.prototype[0] = 1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {}; x.unshift(0) === 2. Actual: ' + (unshift));
}
//CHECK#6
if (x[0] !== 0) {
$ERROR('#6: Object.prototype[0] = 1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {}; x.unshift(0); x[0] === 0. Actual: ' + (x[0]));
if (x[0] !== 0) {
$ERROR('#6: Object.prototype[0] = 1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {}; x.unshift(0); x[0] === 0. Actual: ' + (x[0]));
}
//CHECK#7
if (x[1] !== 1) {
$ERROR('#7: Object.prototype[0] = 1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {}; x.unshift(0); x[1] === 1. Actual: ' + (x[1]));
if (x[1] !== 1) {
$ERROR('#7: Object.prototype[0] = 1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {}; x.unshift(0); x[1] === 1. Actual: ' + (x[1]));
}
delete x[0];
//CHECK#8
if (x[0] !== 1) {
$ERROR('#8: Object.prototype[0] = 1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {}; x.unshift(0); delete x[0]; x[0] === 1. Actual: ' + (x[0]));
if (x[0] !== 1) {
$ERROR('#8: Object.prototype[0] = 1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {}; x.unshift(0); delete x[0]; x[0] === 1. Actual: ' + (x[0]));
}
//CHECK#9
if (x.length !== 2) {
$ERROR('#9: Object.prototype[0] = 1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {}; x.unshift(0); x.length === 1. Actual: ' + (x.length));
if (x.length !== 2) {
$ERROR('#9: Object.prototype[0] = 1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {}; x.unshift(0); x.length === 1. Actual: ' + (x.length));
}
//CHECK#10
delete x.length;
if (x.length !== 1) {
$ERROR('#10: Object.prototype[1] = 1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {}; x.unshift(0); delete x; x.length === 1. Actual: ' + (x.length));
if (x.length !== 1) {
$ERROR('#10: Object.prototype[1] = 1; Object.prototype.length = 1; Object.prototype.unshift = Array.prototype.unshift; x = {}; x.unshift(0); delete x; x.length === 1. Actual: ' + (x.length));
}

View File

@ -3,6 +3,7 @@
/*---
info: The unshift property of Array can't be used as constructor
esid: sec-array.prototype.unshift
es5id: 15.4.4.13_A5.7
description: >
If property does not implement the internal [[Construct]] method,

View File

@ -2,6 +2,7 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.unshift
es6id: 22.1.3.28
description: >
Array.prototype.unshift.name is "unshift".