aboutsummaryrefslogtreecommitdiffstats
path: root/website/resources/scripts/testcases2/15.4.4.7_Array_prototype_push.json
diff options
context:
space:
mode:
Diffstat (limited to 'website/resources/scripts/testcases2/15.4.4.7_Array_prototype_push.json')
-rw-r--r--website/resources/scripts/testcases2/15.4.4.7_Array_prototype_push.json114
1 files changed, 114 insertions, 0 deletions
diff --git a/website/resources/scripts/testcases2/15.4.4.7_Array_prototype_push.json b/website/resources/scripts/testcases2/15.4.4.7_Array_prototype_push.json
new file mode 100644
index 000000000..9f8df13c4
--- /dev/null
+++ b/website/resources/scripts/testcases2/15.4.4.7_Array_prototype_push.json
@@ -0,0 +1,114 @@
+{
+ "testCollection": {
+ "name": "15.4.4.7_Array_prototype_push",
+ "numTests": 17,
+ "tests": [
+ {
+ "section": "15.4.4.7",
+ "description": "Checking case when push is given no arguments or one argument",
+ "test": "//CHECK#1\nvar x = new Array();\nvar push = x.push(1);\nif (push !== 1) {\n $ERROR('#1: x = new Array(); x.push(1) === 1. Actual: ' + (push));\n} \n\n//CHECK#2\nif (x[0] !== 1) {\n $ERROR('#2: x = new Array(); x.push(1); x[0] === 1. Actual: ' + (x[0]));\n}\n\n//CHECK#3\nvar push = x.push();\nif (push !== 1) {\n $ERROR('#3: x = new Array(); x.push(1); x.push() === 1. Actual: ' + (push));\n}\n\n//CHECK#4\nif (x[1] !== undefined) {\n $ERROR('#4: x = new Array(); x.push(1); x.push(); x[1] === unedfined. Actual: ' + (x[1]));\n}\n\n//CHECK#5\nvar push = x.push(-1);\nif (push !== 2) {\n $ERROR('#5: x = new Array(); x.push(1); x.push(); x.push(-1) === 2. Actual: ' + (push));\n}\n\n//CHECK#6\nif (x[1] !== -1) {\n $ERROR('#6: x = new Array(); x.push(1); x.push(-1); x[1] === -1. Actual: ' + (x[1]));\n}\n\n//CHECK#7\nif (x.length !== 2) {\n $ERROR('#7: x = new Array(); x.push(1); x.push(); x.push(-1); x.length === 2. Actual: ' + (x.length));\n} \n",
+ "id": "S15.4.4.7_A1_T1"
+ },
+ {
+ "section": "15.4.4.7",
+ "description": "Checking case when push is given many arguments",
+ "test": "//CHECK#1\nvar x = [];\nif (x.length !== 0) {\n $ERROR('#1: x = []; x.length === 0. Actual: ' + (x.length));\n}\n\n//CHECK#2\nx[0] = 0;\nvar push = x.push(true, Number.POSITIVE_INFINITY, \"NaN\", \"1\", -1);\nif (push !== 6) {\n $ERROR('#2: x = []; x[0] = 0; x.push(true, Number.POSITIVE_INFINITY, \"NaN\", \"1\", -1) === 6. Actual: ' + (push));\n} \n\n//CHECK#3\nif (x[0] !== 0) {\n $ERROR('#3: x = []; x[0] = 0; x.push(true, Number.POSITIVE_INFINITY, \"NaN\", \"1\", -1); x[0] === 0. Actual: ' + (x[0]));\n}\n\n//CHECK#4\nif (x[1] !== true) {\n $ERROR('#4: x = []; x[0] = 0; x.push(true, Number.POSITIVE_INFINITY, \"NaN\", \"1\", -1); x[1] === true. Actual: ' + (x[1]));\n}\n\n//CHECK#5\nif (x[2] !== Number.POSITIVE_INFINITY) {\n $ERROR('#5: x = []; x[0] = 0; x.push(true, Number.POSITIVE_INFINITY, \"NaN\", \"1\", -1); x[2] === Number.POSITIVE_INFINITY. Actual: ' + (x[2]));\n} \n\n//CHECK#6\nif (x[3] !== \"NaN\") {\n $ERROR('#6: x = []; x[0] = 0; x.push(true, Number.POSITIVE_INFINITY, \"NaN\", \"1\", -1); x[3] === \"NaN\". Actual: ' + (x[3]));\n} \n\n//CHECK#7\nif (x[4] !== \"1\") {\n $ERROR('#7: x = []; x[0] = 0; x.push(true, Number.POSITIVE_INFINITY, \"NaN\", \"1\", -1); x[4] === \"1\". Actual: ' + (x[4]));\n}\n\n//CHECK#8\nif (x[5] !== -1) {\n $ERROR('#8: x = []; x[0] = 0; x.push(true, Number.POSITIVE_INFINITY, \"NaN\", \"1\", -1); x[5] === -1. Actual: ' + (x[5]));\n}\n\n//CHECK#9\nif (x.length !== 6) {\n $ERROR('#9: x = []; x[0] = 0; x.push(true, Number.POSITIVE_INFINITY, \"NaN\", \"1\", -1); x.length === 6. Actual: ' + (x.length));\n}\n",
+ "id": "S15.4.4.7_A1_T2"
+ },
+ {
+ "section": "15.4.4.7",
+ "description": "The arguments are appended to the end of the array, in\nthe order in which they appear. The new length of the array is returned\nas the result of the call",
+ "test": "var obj = {};\nobj.push = Array.prototype.push;\n\nif (obj.length !== undefined) {\n $ERROR('#0: var obj = {}; obj.length === undefined. Actual: ' + (obj.length));\n} else {\n //CHECK#1 \n var push = obj.push(-1);\nif (push !== 1) {\n $ERROR('#1: var obj = {}; obj.push = Array.prototype.push; obj.push(-1) === 1. Actual: ' + (push));\n }\n //CHECK#2\n if (obj.length !== 1) {\n $ERROR('#2: var obj = {}; obj.push = Array.prototype.push; obj.push(-1); obj.length === 1. Actual: ' + (obj.length));\n }\n //CHECK#3\n if (obj[\"0\"] !== -1) {\n $ERROR('#3: var obj = {}; obj.push = Array.prototype.push; obj.push(-1); obj[\"0\"] === -1. Actual: ' + (obj[\"0\"]));\n }\n} \n\n//CHECK#4\nobj.length = undefined;\nvar push = obj.push(-4);\nif (push !== 1) {\n $ERROR('#4: var obj = {}; obj.length = undefined; obj.push = Array.prototype.push; obj.push(-4) === 1. Actual: ' + (push));\n} \n\n//CHECK#5\nif (obj.length !== 1) {\n $ERROR('#5: var obj = {}; obj.length = undefined; obj.push = Array.prototype.push; obj.push(-4); obj.length === 1. Actual: ' + (obj.length));\n}\n\n//CHECK#6\nif (obj[\"0\"] !== -4) {\n $ERROR('#6: var obj = {}; obj.length = undefined; obj.push = Array.prototype.push; obj.push(-4); obj[\"0\"] === -4. Actual: ' + (obj[\"0\"]));\n}\n\n//CHECK#7\nobj.length = null\nvar push = obj.push(-7);\nif (push !== 1) {\n $ERROR('#7: var obj = {}; obj.length = null; obj.push = Array.prototype.push; obj.push(-7) === 1. Actual: ' + (push));\n} \n\n//CHECK#8\nif (obj.length !== 1) {\n $ERROR('#8: var obj = {}; obj.length = null; obj.push = Array.prototype.push; obj.push(-7); obj.length === 1. Actual: ' + (obj.length));\n}\n\n//CHECK#9\nif (obj[\"0\"] !== -7) {\n $ERROR('#9: var obj = {}; obj.length = null; obj.push = Array.prototype.push; obj.push(-7); obj[\"0\"] === -7. Actual: ' + (obj[\"0\"]));\n}\n",
+ "id": "S15.4.4.7_A2_T1"
+ },
+ {
+ "section": "15.4.4.7",
+ "description": "The arguments are appended to the end of the array, in\nthe order in which they appear. The new length of the array is returned\nas the result of the call",
+ "test": "var obj = {};\nobj.push = Array.prototype.push;\n\n//CHECK#1\nobj.length = NaN;\nvar push = obj.push(-1);\nif (push !== 1) {\n $ERROR('#1: var obj = {}; obj.length = NaN; obj.push = Array.prototype.push; obj.push(-1) === 1. Actual: ' + (push));\n}\n\n//CHECK#2\nif (obj.length !== 1) {\n $ERROR('#2: var obj = {}; obj.length = NaN; obj.push = Array.prototype.push; obj.push(-1); obj.length === 1. Actual: ' + (obj.length));\n}\n\n//CHECK#3\nif (obj[\"0\"] !== -1) {\n $ERROR('#3: var obj = {}; obj.length = NaN; obj.push = Array.prototype.push; obj.push(-1); obj[\"0\"] === -1. Actual: ' + (obj[\"0\"]));\n}\n\n//CHECK#4\nobj.length = Number.POSITIVE_INFINITY;\nvar push = obj.push(-4);\nif (push !== 1) {\n $ERROR('#4: var obj = {}; obj.length = Number.POSITIVE_INFINITY; obj.push = Array.prototype.push; obj.push(-4) === 1. Actual: ' + (push));\n}\n\n//CHECK#5\nif (obj.length !== 1) {\n $ERROR('#6: var obj = {}; obj.length = Number.POSITIVE_INFINITY; obj.push = Array.prototype.push; obj.push(-4); obj.length === 1. Actual: ' + (obj.length));\n}\n\n//CHECK#6\nif (obj[\"0\"] !== -4) {\n $ERROR('#6: var obj = {}; obj.length = Number.POSITIVE_INFINITY; obj.push = Array.prototype.push; obj.push(-4); obj[\"0\"] === -4. Actual: ' + (obj[\"0\"]));\n}\n\n//CHECK#7\nobj.length = Number.NEGATIVE_INFINITY;\nvar push = obj.push(-7);\nif (push !== 1) {\n $ERROR('#7: var obj = {}; obj.length = Number.NEGATIVE_INFINITY; obj.push = Array.prototype.push; obj.push(-7) === 1. Actual: ' + (push));\n}\n\n//CHECK#8\nif (obj.length !== 1) {\n $ERROR('#8: var obj = {}; obj.length = Number.NEGATIVE_INFINITY; obj.push = Array.prototype.push; obj.push(-7); obj.length === 1. Actual: ' + (obj.length));\n}\n\n//CHECK#9\nif (obj[\"0\"] !== -7) {\n $ERROR('#9: var obj = {}; obj.length = Number.NEGATIVE_INFINITY; obj.push = Array.prototype.push; obj.push(-7); obj[\"0\"] === -7. Actual: ' + (obj[\"0\"]));\n}\n\n//CHECK#10\nobj.length = 0.5;\nvar push = obj.push(-10);\nif (push !== 1) {\n $ERROR('#10: var obj = {}; obj.length = 0.5; obj.push = Array.prototype.push; obj.push(-10) === 1. Actual: ' + (push));\n}\n\n//CHECK#11\nif (obj.length !== 1) {\n $ERROR('#11: var obj = {}; obj.length = 0.5; obj.push = Array.prototype.push; obj.push(-10); obj.length === 1. Actual: ' + (obj.length));\n} \n\n//CHECK#12\nif (obj[\"0\"] !== -10) {\n $ERROR('#12: var obj = {}; obj.length = 0.5; obj.push = Array.prototype.push; obj.push(-10); obj[\"0\"] === -10. Actual: ' + (obj[\"0\"]));\n}\n\n//CHECK#13\nobj.length = 1.5;\nvar push = obj.push(-13);\nif (push !== 2) {\n $ERROR('#13: var obj = {}; obj.length = 1.5; obj.push = Array.prototype.push; obj.push(-13) === 2. Actual: ' + (push));\n}\n\n//CHECK#14\nif (obj.length !== 2) {\n $ERROR('#14: var obj = {}; obj.length = 1.5; obj.push = Array.prototype.push; obj.push(-13); obj.length === 2. Actual: ' + (obj.length));\n} \n\n//CHECK#15\nif (obj[\"1\"] !== -13) {\n $ERROR('#15: var obj = {}; obj.length = 1.5; obj.push = Array.prototype.push; obj.push(-13); obj[\"1\"] === -13. Actual: ' + (obj[\"1\"]));\n}\n\n//CHECK#16\nobj.length = new Number(0);\nvar push = obj.push(-16);\nif (push !== 1) {\n $ERROR('#16: var obj = {}; obj.length = new Number(0); obj.push = Array.prototype.push; obj.push(-16) === 1. Actual: ' + (push));\n}\n\n//CHECK#17\nif (obj.length !== 1) {\n $ERROR('#17: var obj = {}; obj.length = new Number(0); obj.push = Array.prototype.push; obj.push(-16); obj.length === 1. Actual: ' + (obj.length));\n}\n\n//CHECK#18\nif (obj[\"0\"] !== -16) {\n $ERROR('#18: var obj = {}; obj.length = new Number(0); obj.push = Array.prototype.push; obj.push(-16); obj[\"0\"] === -16. Actual: ' + (obj[\"0\"]));\n} \n",
+ "id": "S15.4.4.7_A2_T2"
+ },
+ {
+ "section": "15.4.4.7",
+ "description": "Operator use ToNumber from length.\nIf Type(value) is Object, evaluate ToPrimitive(value, Number)",
+ "test": "var obj = {};\nobj.push = Array.prototype.push;\n\n//CHECK#1\nobj.length = {valueOf: function() {return 3}};\nvar push = obj.push();\nif (push !== 3) {\n $ERROR('#1: obj.length = {valueOf: function() {return 3}} obj.push() === 3. Actual: ' + (push));\n}\n\n//CHECK#2\nobj.length = {valueOf: function() {return 3}, toString: function() {return 1}};\nvar push = obj.push();\nif (push !== 3) {\n $ERROR('#0: obj.length = {valueOf: function() {return 3}, toString: function() {return 1}} obj.push() === 3. Actual: ' + (push));\n} \n\n//CHECK#3\nobj.length = {valueOf: function() {return 3}, toString: function() {return {}}};\nvar push = obj.push();\nif (push !== 3) {\n $ERROR('#1: obj.length = {valueOf: function() {return 3}, toString: function() {return {}}} obj.push() === 3. Actual: ' + (push));\n}\n\n//CHECK#4\ntry { \n \n obj.length = {valueOf: function() {return 3}, toString: function() {throw \"error\"}}; \n var push = obj.push();\nif (push !== 3) {\n $ERROR('#4.1: obj.length = {valueOf: function() {return 3}, toString: function() {throw \"error\"}}; obj.push() === \",\". Actual: ' + (push));\n }\n}\ncatch (e) {\n if (e === \"error\") {\n $ERROR('#4.2: obj.length = {valueOf: function() {return 3}, toString: function() {throw \"error\"}}; obj.push() not throw \"error\"');\n } else {\n $ERROR('#4.3: obj.length = {valueOf: function() {return 3}, toString: function() {throw \"error\"}}; obj.push() not throw Error. Actual: ' + (e));\n }\n}\n\n//CHECK#5\nobj.length = {toString: function() {return 1}};\nvar push = obj.push();\nif (push !== 1) {\n $ERROR('#5: obj.length = {toString: function() {return 1}} obj.push() === 1. Actual: ' + (push));\n}\n\n//CHECK#6\nobj.length = {valueOf: function() {return {}}, toString: function() {return 1}}\nvar push = obj.push();\nif (push !== 1) {\n $ERROR('#6: obj.length = {valueOf: function() {return {}}, toString: function() {return 1}} obj.push() === 1. Actual: ' + (push));\n}\n\n//CHECK#7\ntry {\n \n obj.length = {valueOf: function() {throw \"error\"}, toString: function() {return 1}}; \n var push = obj.push();\n $ERROR('#7.1: obj.length = {valueOf: function() {throw \"error\"}, toString: function() {return 1}}; obj.push() throw \"error\". Actual: ' + (push));\n} \ncatch (e) {\n if (e !== \"error\") {\n $ERROR('#7.2: obj.length = {valueOf: function() {throw \"error\"}, toString: function() {return 1}}; obj.push() throw \"error\". Actual: ' + (e));\n } \n}\n\n//CHECK#8\ntry {\n \n obj.length = {valueOf: function() {return {}}, toString: function() {return {}}};\n var push = obj.push();\n $ERROR('#8.1: obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.push() throw TypeError. Actual: ' + (push));\n} \ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#8.2: obj.length = {valueOf: function() {return {}}, toString: function() {return {}}} obj.push() throw TypeError. Actual: ' + (e));\n } \n}\n",
+ "id": "S15.4.4.7_A2_T3"
+ },
+ {
+ "section": "15.4.4.7",
+ "description": "If ToUint32(length) !== length, throw RangeError",
+ "test": "var x = [];\nx.length = 4294967295;\n\n//CHECK#1\nvar push = x.push();\nif (push !== 4294967295) {\n $ERROR('#1: x = []; x.length = 4294967295; x.push() === 4294967295. Actual: ' + (push));\n}\n\n//CHECK#2\ntry {\n x.push(\"x\");\n $ERROR('#2.1: x = []; x.length = 4294967295; x.push(\"x\") throw RangeError. Actual: ' + (push));\n} catch(e) {\n if ((e instanceof RangeError) !== true) {\n $ERROR('#2.2: x = []; x.length = 4294967295; x.push(\"x\") throw RangeError. Actual: ' + (e));\n }\n}\n\n//CHECK#3\nif (x[4294967295] !== \"x\") {\n $ERROR('#3: x = []; x.length = 4294967295; try {x.push(\"x\")}catch(e){}; x[4294967295] === \"x\". Actual: ' + (x[4294967295]));\n}\n\n//CHECK#4\nif (x.length !== 4294967295) {\n $ERROR('#4: x = []; x.length = 4294967295; try {x.push(\"x\")}catch(e){}; x.length === 4294967295. Actual: ' + (x.length));\n}\n",
+ "id": "S15.4.4.7_A3"
+ },
+ {
+ "section": "15.4.4.7",
+ "description": "length = 4294967296",
+ "test": "var obj = {};\nobj.push = Array.prototype.push;\nobj.length = 4294967296;\n\n//CHECK#1\nvar push = obj.push(\"x\", \"y\", \"z\");\nif (push !== 3) {\n $ERROR('#1: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push(\"x\", \"y\", \"z\") === 3. Actual: ' + (push));\n}\n\n//CHECK#2\nif (obj.length !== 3) {\n $ERROR('#2: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push(\"x\", \"y\", \"z\"); obj.length === 3. Actual: ' + (obj.length));\n}\n\n//CHECK#3\nif (obj[0] !== \"x\") {\n $ERROR('#3: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push(\"x\", \"y\", \"z\"); obj[0] === \"x\". Actual: ' + (obj[0]));\n}\n\n//CHECK#4\nif (obj[1] !== \"y\") {\n $ERROR('#4: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push(\"x\", \"y\", \"z\"); obj[1] === \"y\". Actual: ' + (obj[1]));\n} \n\n//CHECK#5\nif (obj[2] !== \"z\") {\n $ERROR('#5: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push(\"x\", \"y\", \"z\"); obj[2] === \"z\". Actual: ' + (obj[2]));\n} \n\nvar obj = {};\nobj.push = Array.prototype.push;\nobj.length = 4294967296;\n\n//CHECK#6\nvar push = obj.push();\nif (push !== 0) {\n $ERROR('#6: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push() === 0. Actual: ' + (push));\n}\n\n//CHECK#7\nif (obj.length !== 0) {\n $ERROR('#7: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967296; obj.push(); obj.length === 0. Actual: ' + (obj.length));\n} \n",
+ "id": "S15.4.4.7_A4_T1"
+ },
+ {
+ "section": "15.4.4.7",
+ "description": "length = 4294967295",
+ "test": "var obj = {};\nobj.push = Array.prototype.push;\nobj.length = 4294967295;\n\n//CHECK#1\nvar push = obj.push(\"x\", \"y\", \"z\");\nif (push !== 4294967298) {\n $ERROR('#1: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967295; obj.push(\"x\", \"y\", \"z\") === 4294967298. Actual: ' + (push));\n}\n\n//CHECK#2\nif (obj.length !== 4294967298) {\n $ERROR('#2: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967295; obj.push(\"x\", \"y\", \"z\"); obj.length === 4294967298. Actual: ' + (obj.length));\n}\n\n//CHECK#3\nif (obj[4294967295] !== \"x\") {\n $ERROR('#3: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967295; obj.push(\"x\", \"y\", \"z\"); obj[4294967295] === \"x\". Actual: ' + (obj[4294967295]));\n}\n\n//CHECK#4\nif (obj[4294967296] !== \"y\") {\n $ERROR('#4: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967295; obj.push(\"x\", \"y\", \"z\"); obj[4294967296] === \"y\". Actual: ' + (obj[4294967296]));\n} \n\n//CHECK#5\nif (obj[4294967297] !== \"z\") {\n $ERROR('#5: var obj = {}; obj.push = Array.prototype.push; obj.length = 4294967295; obj.push(\"x\", \"y\", \"z\"); obj[4294967297] === \"z\". Actual: ' + (obj[4294967297]));\n} \n",
+ "id": "S15.4.4.7_A4_T2"
+ },
+ {
+ "section": "15.4.4.7",
+ "description": "length = -1",
+ "test": "var obj = {};\nobj.push = Array.prototype.push;\nobj.length = -1;\n\n//CHECK#1\nvar push = obj.push(\"x\", \"y\", \"z\");\nif (push !== 4294967298) {\n $ERROR('#1: var obj = {}; obj.push = Array.prototype.push; obj.length = -1; obj.push(\"x\", \"y\", \"z\") === 4294967298. Actual: ' + (push));\n}\n\n//CHECK#2\nif (obj.length !== 4294967298) {\n $ERROR('#2: var obj = {}; obj.push = Array.prototype.push; obj.length = -1; obj.push(\"x\", \"y\", \"z\"); obj.length === 4294967298. Actual: ' + (obj.length));\n}\n\n//CHECK#3\nif (obj[4294967295] !== \"x\") {\n $ERROR('#3: var obj = {}; obj.push = Array.prototype.push; obj.length = -1; obj.push(\"x\", \"y\", \"z\"); obj[4294967295] === \"x\". Actual: ' + (obj[4294967295]));\n}\n\n//CHECK#4\nif (obj[4294967296] !== \"y\") {\n $ERROR('#4: var obj = {}; obj.push = Array.prototype.push; obj.length = -1; obj.push(\"x\", \"y\", \"z\"); obj[4294967296] === \"y\". Actual: ' + (obj[4294967296]));\n} \n\n//CHECK#5\nif (obj[4294967297] !== \"z\") {\n $ERROR('#5: var obj = {}; obj.push = Array.prototype.push; obj.length = -1; obj.push(\"x\", \"y\", \"z\"); obj[4294967297] === \"z\". Actual: ' + (obj[4294967297]));\n} \n",
+ "id": "S15.4.4.7_A4_T3"
+ },
+ {
+ "section": "15.4.4.7, 8.6.2.1",
+ "description": "[[Prototype]] of Array instance is Array.prototype, [[Prototype] of Array.prototype is Object.prototype",
+ "test": "Object.prototype[1] = -1;\nObject.prototype.length = 1;\nObject.prototype.push = Array.prototype.push;\nvar x = {0:0};\n\n//CHECK#1\nvar push = x.push(1);\nif (push !== 2) { \n $ERROR('#1: Object.prototype[1] = 1; Object.prototype.length = -1; Object.prototype.push = Array.prototype.push; x = {0:0}; x.push(1) === 2. Actual: ' + (push)); \n}\n\n//CHECK#2\nif (x.length !== 2) { \n $ERROR('#2: Object.prototype[1] = 1; Object.prototype.length = -1; Object.prototype.push = Array.prototype.push; x = {0:0}; x.push(1); x.length === 2. Actual: ' + (x.length)); \n}\n\n//CHECK#3\nif (x[1] !== 1) { \n $ERROR('#3: Object.prototype[1] = 1; Object.prototype.length = -1; Object.prototype.push = Array.prototype.push; x = {0:0}; x.push(1); x[1] === 1. Actual: ' + (x[1])); \n}\n\n//CHECK#4\ndelete x[1];\nif (x[1] !== -1) { \n $ERROR('#4: Object.prototype[1] = 1; Object.prototype.length = -1; Object.prototype.push = Array.prototype.push; x = {0:0}; x.push(1); delete x[1]; x[1] === -1. Actual: ' + (x[1])); \n}\n\n//CHECK#5\ndelete x.length;\nif (x.length !== 1) { \n $ERROR('#5: Object.prototype[1] = 1; Object.prototype.length = -1; Object.prototype.push = Array.prototype.push; x = {0:0}; delete x; x.push(1); x.length === 1. Actual: ' + (x.length)); \n}\n\n",
+ "id": "S15.4.4.7_A5_T1"
+ },
+ {
+ "section": "15.4.4.7, 15.2.4.7, 12.6.4",
+ "description": "Checking use propertyIsEnumerable, for-in",
+ "test": "//CHECK#1\nif (Array.prototype.push.propertyIsEnumerable('length') !== false) {\n $ERROR('#1: Array.prototype.push.propertyIsEnumerable(\\'length\\') === false. Actual: ' + (Array.prototype.push.propertyIsEnumerable('length')));\n}\n\n//CHECK#2\nvar result = true;\nfor (var p in Array.push){\n if (p === \"length\") {\n result = false;\n } \n}\n\nif (result !== true) {\n $ERROR('#2: result = true; for (p in Array.push) { if (p === \"length\") result = false; } result === true;');\n}\n\n",
+ "id": "S15.4.4.7_A6.1"
+ },
+ {
+ "section": "15.4.4.7, 15.2.4.5, 11.4.1",
+ "description": "Checking use hasOwnProperty, delete",
+ "strict_mode_negative": "",
+ "test": "//CHECK#1\nif (Array.prototype.push.hasOwnProperty('length') !== true) {\n $FAIL('#1: Array.prototype.push.hasOwnProperty(\\'length\\') === true. Actual: ' + (Array.prototype.push.hasOwnProperty('length')));\n}\n\ndelete Array.prototype.push.length;\n\n//CHECK#2\nif (Array.prototype.push.hasOwnProperty('length') !== true) {\n $ERROR('#2: delete Array.prototype.push.length; Array.prototype.push.hasOwnProperty(\\'length\\') === true. Actual: ' + (Array.prototype.push.hasOwnProperty('length')));\n}\n\n//CHECK#3\nif (Array.prototype.push.length === undefined) {\n $ERROR('#3: delete Array.prototype.push.length; Array.prototype.push.length !== undefined');\n}\n\n\n",
+ "id": "S15.4.4.7_A6.2",
+ "strict_only": ""
+ },
+ {
+ "section": "15.4.4.7",
+ "description": "Checking if varying the length property fails",
+ "strict_mode_negative": "",
+ "test": "//CHECK#1\nvar x = Array.prototype.push.length;\nArray.prototype.push.length = Infinity;\nif (Array.prototype.push.length !== x) {\n $ERROR('#1: x = Array.prototype.push.length; Array.prototype.push.length = Infinity; Array.prototype.push.length === x. Actual: ' + (Array.prototype.push.length));\n}\n\n",
+ "id": "S15.4.4.7_A6.3",
+ "strict_only": ""
+ },
+ {
+ "section": "15.4.4.7",
+ "description": "push.length === 1",
+ "test": "//CHECK#1\nif (Array.prototype.push.length !== 1) {\n $ERROR('#1: Array.prototype.push.length === 1. Actual: ' + (Array.prototype.push.length));\n}\n\n",
+ "id": "S15.4.4.7_A6.4"
+ },
+ {
+ "section": "15.4.4.7, 15.2.4.7, 12.6.4",
+ "description": "Checking use propertyIsEnumerable, for-in",
+ "test": "//CHECK#1\nif (Array.propertyIsEnumerable('push') !== false) {\n $ERROR('#1: Array.propertyIsEnumerable(\\'push\\') === false. Actual: ' + (Array.propertyIsEnumerable('push')));\n}\n\n//CHECK#2\nvar result = true;\nfor (var p in Array){\n if (p === \"push\") {\n result = false;\n } \n}\n\nif (result !== true) {\n $ERROR('#2: result = true; for (p in Array) { if (p === \"push\") result = false; } result === true;');\n}\n\n",
+ "id": "S15.4.4.7_A6.5"
+ },
+ {
+ "section": "15.4.4.7",
+ "description": "Checking Array.prototype.push.prototype",
+ "test": "//CHECK#1\nif (Array.prototype.push.prototype !== undefined) {\n $ERROR('#1: Array.prototype.push.prototype === undefined. Actual: ' + (Array.prototype.push.prototype));\n}\n",
+ "id": "S15.4.4.7_A6.6"
+ },
+ {
+ "section": "15.4.4.7, 11.2.2",
+ "description": "If property does not implement the internal [[Construct]] method, throw a TypeError exception",
+ "test": "//CHECK#1\n\ntry {\n new Array.prototype.push();\n $ERROR('#1.1: new Array.prototype.push() throw TypeError. Actual: ' + (new Array.prototype.push()));\n} catch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#1.2: new Array.prototype.push() throw TypeError. Actual: ' + (e));\n }\n}\n",
+ "id": "S15.4.4.7_A6.7"
+ }
+ ]
+ }
+}