aboutsummaryrefslogtreecommitdiffstats
path: root/website/resources/scripts/testcases2/15.4.3_Properties_of_the_Array_Constructor.json
blob: 900090b46b6ea217983774b3cc22cbe199e0363e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
 "testCollection": {
  "name": "15.4.3_Properties_of_the_Array_Constructor",
  "numTests": 7,
  "tests": [
   {
    "section": "15.4.3, 15.2.4.5",
    "description": "Create new property of Function.prototype. When Array constructor has this property",
    "test": "Function.prototype.myproperty = 1;\n\n//CHECK#1\nif (Array.myproperty !== 1) {\n  $ERROR('#1: Function.prototype.myproperty = 1; Array.myproperty === 1. Actual: ' + (Array.myproperty));\n}\n\n//CHECK#2\nif (Array.hasOwnProperty('myproperty') !== false) {\n  $ERROR('#2: Function.prototype.myproperty = 1; Array.hasOwnProperty(\\'myproperty\\') === false. Actual: ' + (Array.hasOwnProperty('myproperty')));\n}\n",
    "id": "S15.4.3_A1.1_T1"
   },
   {
    "section": "15.4.3, 15.2.4.2",
    "description": "Function.prototype.toString = Object.prototype.toString",
    "test": "//CHECK#1\nFunction.prototype.toString = Object.prototype.toString;\nif (Array.toString() !== \"[object \" + \"Function\" + \"]\") {\n  $ERROR('#1: Function.prototype.toString = Object.prototype.toString; Array.toString() === \"[object \" + \"Function\" + \"]\". Actual: ' + (Array.toString()));\n}\n",
    "id": "S15.4.3_A1.1_T2"
   },
   {
    "section": "15.4.3, 15.2.4.6",
    "description": "Checking use isPrototypeOf",
    "test": "//CHECK#1\nif (Function.prototype.isPrototypeOf(Array) !== true) {\n  $ERROR('#1: Function.prototype.isPrototypeOf(Array) === true. Actual: ' + (Function.prototype.isPrototypeOf(Array)));\n}\n",
    "id": "S15.4.3_A1.1_T3"
   },
   {
    "section": "15.4.3, 15.2.4.7, 12.6.4",
    "description": "Checking use propertyIsEnumerable, for-in",
    "test": "//CHECK#1\nif (Array.propertyIsEnumerable('length') !== false) {\n  $ERROR('#1: Array.propertyIsEnumerable(\\'length\\') === false. Actual: ' + (Array.propertyIsEnumerable('length')));\n}\n\n//CHECK#2\nresult = true;\nfor (p in Array){\n  if (p === \"length\") {\n    result = false;\n  }  \n}\n\nif (result !== true) {\n  $ERROR('#2: result = true; for (p in Array.slice) { if (p === \"length\") result = false; }  result === true;');\n}\n\n",
    "id": "S15.4.3_A2.1"
   },
   {
    "section": "15.4.3, 15.2.4.5, 11.4.1",
    "description": "Checking use hasOwnProperty, delete",
    "test": "//CHECK#1\nif (Array.hasOwnProperty('length') !== true) {\n  $FAIL('#1: Array.hasOwnProperty(\\'length\\') === true. Actual: ' + (Array.hasOwnProperty('length')));\n}\n\ndelete Array.length;\n\n//CHECK#2\nif (Array.hasOwnProperty('length') !== true) {\n  $ERROR('#2: delete Array.length; Array.hasOwnProperty(\\'length\\') === true. Actual: ' + (Array.hasOwnProperty('length')));\n}\n\n//CHECK#3\nif (Array.length === undefined) {\n  $ERROR('#3: delete Array.length; Array.length !== undefined');\n}\n\n\n",
    "id": "S15.4.3_A2.2"
   },
   {
    "section": "15.4.3",
    "description": "Checking if varying the length property fails",
    "test": "//CHECK#1\nx = Array.length;\nArray.length = Infinity;\nif (Array.length !== x) {\n  $ERROR('#1: x = Array.length; Array.length = Infinity; Array.length === x. Actual: ' + (Array.length));\n}\n\n",
    "id": "S15.4.3_A2.3"
   },
   {
    "section": "15.4.3",
    "description": "Array.length === 1",
    "test": "//CHECK#1\nif (Array.length !== 1) {\n  $ERROR('#1: Array.length === 1. Actual: ' + (Array.length));\n}\n\n",
    "id": "S15.4.3_A2.4"
   }
  ]
 }
}