aboutsummaryrefslogtreecommitdiffstats
path: root/website/resources/scripts/testcases2/15.4.4_Properties_of_the_Array_Prototype_Object.json
blob: ab1d815ce5f73f519ca21b7ad9bbcfa5eeebe439 (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.4_Properties_of_the_Array_Prototype_Object",
  "numTests": 7,
  "tests": [
   {
    "section": "15.4.4, 15.2.4.5",
    "description": "Create new property of Function.prototype. When Array.prototype object has this property",
    "test": "Object.prototype.myproperty = 1;\n\n//CHECK#1\nif (Array.prototype.myproperty !== 1) {\n  $ERROR('#1: Object.prototype.myproperty = 1; Array.prototype.myproperty === 1. Actual: ' + (Array.prototype.myproperty));\n}\n\n//CHECK#2\nif (Array.prototype.hasOwnProperty('myproperty') !== false) {\n  $ERROR('#2: Object.prototype.myproperty = 1; Array.prototype.hasOwnProperty(\\'myproperty\\') === false. Actual: ' + (Array.prototype.hasOwnProperty('myproperty')));\n}\n",
    "id": "S15.4.4_A1.1_T1"
   },
   {
    "section": "15.4.4",
    "test": "//CHECK#1\nif (Object.prototype.toString.call(Array.prototype) !== \"[object Array]\") {\n  $ERROR('The Array prototype object is itself an array; its' +\n         '[[Class]] is \"Array\".');\n}\n",
    "id": "S15.4.4_A1.1_T2",
    "description": ":The Array prototype object is itself an array; its [[Class]] is \"Array\","
   },
   {
    "section": "15.4.4, 15.2.4.6",
    "description": "Checking use isPrototypeOf",
    "test": "//CHECK#1\nif (Object.prototype.isPrototypeOf(Array.prototype) !== true) {\n  $ERROR('#1: Object.prototype.isPrototypeOf(Array.prototype) === true. Actual: ' + (Object.prototype.isPrototypeOf(Array.prototype)));\n}\n",
    "id": "S15.4.4_A1.1_T3"
   },
   {
    "section": "15.4.4, 15.2.4.2",
    "description": "Checking use Object.prototype.toString",
    "test": "//CHECK#1\nArray.prototype.getClass = Object.prototype.toString;\nif (Array.prototype.getClass() !== \"[object \" + \"Array\" + \"]\") {\n  $ERROR('#1: Array.prototype.getClass = Object.prototype.toString; Array.prototype is Array object. Actual: ' + (Array.prototype.getClass()));\n}\n",
    "id": "S15.4.4_A1.2_T1"
   },
   {
    "section": "15.4.4",
    "description": "Array.prototype.length === 0",
    "test": "//CHECK#1\nif (Array.prototype.length !== 0) {\n  $ERROR('#1.1: Array.prototype.length === 0. Actual: ' + (Array.prototype.length));\n} else {\n  if (1 / Array.prototype.length !== Number.POSITIVE_INFINITY) {\n    $ERROR('#1.2: Array.prototype.length === +0. Actual: ' + (Array.prototype.length));\n  }\n} \n   \n",
    "id": "S15.4.4_A1.3_T1"
   },
   {
    "section": "15.4.4, 15.2.4.5",
    "description": "Checking use hasOwnProperty",
    "test": "//CHECK#1\nif (Array.prototype.hasOwnProperty('valueOf') !== false) {\n  $ERROR('#1: Array.prototype.hasOwnProperty(\\'valueOf\\') === false. Actual: ' + (Array.prototype.hasOwnProperty('valueOf')));\n}\n",
    "id": "S15.4.4_A2.1_T1"
   },
   {
    "section": "15.4.4",
    "description": "Change valueOf property of Object.prototype. When Array.prototype.valueOf also change",
    "test": "Object.prototype.valueOf = 1;\n\n//CHECK#1\nif (Array.prototype.valueOf !== 1) {\n  $ERROR('#1: Object.prototype.valueOf = 1; Array.prototype.valueOf === 1. Actual: ' + (Array.prototype.valueOf));\n}\n\n//CHECK#2\nvar x = new Array();\nif (x.valueOf !== 1) {\n  $ERROR('#1: Object.prototype.valueOf = 1; x = new Array(); x.valueOf === 1. Actual: ' + (x.valueOf));\n}\n",
    "id": "S15.4.4_A2.1_T2"
   }
  ]
 }
}