aboutsummaryrefslogtreecommitdiffstats
path: root/website/resources/scripts/testcases2/10.1.4_Scope_Chain_and_Identifier_Resolution.json
blob: 8d6e8671a49ff6068674501b87b748f2ff587ed5 (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
51
52
53
54
55
56
57
58
59
60
61
62
{
 "testCollection": {
  "name": "10.1.4_Scope_Chain_and_Identifier_Resolution",
  "numTests": 9,
  "tests": [
   {
    "section": "10.1.4",
    "description": "Checking scope chain containing function declarations",
    "test": "var x = 0;\n\nfunction f1(){\n  var x = 1;\n  function f2(){\n    return x;\n  };\n  return f2();\n}\n\nif(!(f1() === 1)){\n  $ERROR(\"#1: Scope chain disturbed\");\n}\n",
    "id": "S10.1.4_A1_T1"
   },
   {
    "section": "10.1.4",
    "description": "Checking scope chain containing function declarations",
    "test": "var x = 0;\n\nfunction f1(){\n  function f2(){\n    return x;\n  };\n  return f2();\n}\n\nif(!(f1() === 0)){\n  $ERROR(\"#1: Scope chain disturbed\");\n}\n",
    "id": "S10.1.4_A1_T2"
   },
   {
    "section": "10.1.4",
    "description": "Checking scope chain containing function declarations",
    "test": "var x = 0;\n\nfunction f1(){\n  function f2(){\n    return x;\n  };\n  return f2();\n  \n  var x = 1;\n}\n\nif(!(f1() === undefined)){\n  $ERROR(\"#1: Scope chain disturbed\");\n}\n\n",
    "id": "S10.1.4_A1_T3"
   },
   {
    "section": "10.1.4",
    "description": "Checking scope chain containing function declarations",
    "test": "var x = 0;\n\nfunction f1(){\n  function f2(){\n    return x;\n  };\n\n  var x = 1;\n  return f2();\n}\n\nif(!(f1() === 1)){\n  $ERROR(\"#1: Scope chain disturbed\");\n}\n",
    "id": "S10.1.4_A1_T4"
   },
   {
    "section": "10.1.4",
    "description": "Checking scope chain containing function declarations and \"with\"",
    "test": "var x = 0;\n\nvar myObj = {x : \"obj\"};\n\nfunction f1(){\n  var x = 1;\n  function f2(){\n    with(myObj){\n      return x;\n    }\n  };\n  return f2();\n}\n\nif(!(f1() === \"obj\")){\n  $ERROR(\"#1: Scope chain disturbed\");\n}\n",
    "id": "S10.1.4_A1_T5"
   },
   {
    "section": "10.1.4",
    "description": "Checking scope chain containing function declarations and \"with\"",
    "test": "var x = 0;\n\nvar myObj = {x : \"obj\"};\n\nfunction f1(){\n  function f2(){\n    with(myObj){\n      return x;\n    }\n  };\n  return f2();\n}\n\nif(!(f1() === \"obj\")){\n  $ERROR(\"#1: Scope chain disturbed\");\n}\n",
    "id": "S10.1.4_A1_T6"
   },
   {
    "section": "10.1.4",
    "description": "Checking scope chain containing function declarations and \"with\"",
    "test": "var x = 0;\n\nvar myObj = {x : \"obj\"};\n\nfunction f1(){\n  function f2(){\n    with(myObj){\n      return x;\n    }\n  };\n  return f2();\n  \n  var x = 1;\n}\n\nif(!(f1() === \"obj\")){\n  $ERROR(\"#1: Scope chain disturbed\");\n}\n",
    "id": "S10.1.4_A1_T7"
   },
   {
    "section": "10.1.4",
    "description": "Checking scope chain containing function declarations and \"with\"",
    "test": "var x = 0;\n\nvar myObj = {x : \"obj\"};\n\nfunction f1(){\n  function f2(){\n    with(myObj){\n      return x;\n    }\n  };\n\n  var x = 1;\n  return f2();\n}\n\nif(!(f1() === \"obj\")){\n  $ERROR(\"#1: Scope chain disturbed\");\n}\n",
    "id": "S10.1.4_A1_T8"
   },
   {
    "section": "10.1.4",
    "description": "Checking scope chain containing function declarations and \"with\"",
    "test": "var x = 0;\n\nvar myObj = {x : \"obj\"};\n\nfunction f1(){\n  with(myObj){\n    return x;\n  }\n}\n\nif(!(f1() === \"obj\")){\n  $ERROR(\"#1: Scope chain disturbed\");\n}\n",
    "id": "S10.1.4_A1_T9"
   }
  ]
 }
}