aboutsummaryrefslogtreecommitdiffstats
path: root/website/resources/scripts/testcases2/11.2.3_Function_Calls.json
blob: 6dabb480d759ae5afd58e238eb1ae6129d806c49 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
 "testCollection": {
  "name": "11.2.3_Function_Calls",
  "numTests": 12,
  "tests": [
   {
    "section": "11.2.3, 7.2, 7.3",
    "description": "Checking by using eval",
    "test": "//CHECK#1\nif (eval(\"Number\\u0009()\") !== 0) {\n  $ERROR('#1: Number\\\\u0009() === 0');\n}\n\n//CHECK#2\nif (eval(\"Number\\u000B()\") !== 0) {\n  $ERROR('#2: Number\\\\u000B() === 0');  \n}\n\n//CHECK#3\nif (eval(\"Number\\u000C()\") !== 0) {\n  $ERROR('#3: Number\\\\u000C() === 0');\n}\n\n//CHECK#4\nif (eval(\"Number\\u0020()\") !== 0) {\n  $ERROR('#4: Number\\\\u0020 === 0');\n}\n\n//CHECK#5\nif (eval(\"Number\\u00A0()\") !== 0) {\n  $ERROR('#5: Number\\\\u00A0() === 0');\n}\n\n//CHECK#6\nif (eval(\"Number\\u000A()\") !== 0) {\n  $ERROR('#6: Number\\\\u000A() === 0');  \n}\n\n//CHECK#7\nif (eval(\"Number\\u000D()\") !== 0) {\n  $ERROR('#7: Number\\\\u000D() === 0');\n}\n\n//CHECK#8\nif (eval(\"Number\\u2028()\") !== 0) {\n  $ERROR('#8: Number\\\\u2028() === 0');\n}\n\n//CHECK#9\nif (eval(\"Number\\u2029()\") !== 0) {\n  $ERROR('#9: Number\\\\u2029() === 0');\n}\n\n//CHECK#10\nif (eval(\"Number\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029()\") !== 0) {\n  $ERROR('#10: Number\\\\u0009\\\\u000B\\\\u000C\\\\u0020\\\\u00A0\\\\u000A\\\\u000D\\\\u2028\\\\u2029() === 0');\n}\n",
    "id": "S11.2.3_A1"
   },
   {
    "section": "11.2.3",
    "description": "If GetBase(MemberExpression) is null, throw ReferenceError",
    "test": "//CHECK#1\ntry {\n  x();\n  $ERROR('#1.1: x() throw ReferenceError. Actual: ' + (x()));  \n}\ncatch (e) {\n  if ((e instanceof ReferenceError) !== true) {\n    $ERROR('#1.2: x() throw ReferenceError. Actual: ' + (e));  \n  }\n}\n\n//CHECK#2\ntry {\n  x(1,2,3);\n  $ERROR('#2.1: x(1,2,3) throw ReferenceError. Actual: ' + (x(1,2,3))); \n}\ncatch (e) {\n  if ((e instanceof ReferenceError) !== true) {\n    $ERROR('#2.2: x(1,2,3) throw ReferenceError. Actual: ' + (e)); \n  }\n}\n",
    "id": "S11.2.3_A2"
   },
   {
    "section": "11.2.3",
    "description": "Checking \"boolean primitive\" case",
    "test": "//CHECK#1\ntry {\n  true();\n    $ERROR('#1.1: true() throw TypeError. Actual: ' + (true()));\t\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#1.2: true() throw TypeError. Actual: ' + (e));\t\n  }\n}\n\n//CHECK#2\ntry {\n  var x = true;\n  x();\n    $ERROR('#2.1: var x = true; x() throw TypeError. Actual: ' + (x()))\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#2.2: var x = true; x() throw TypeError. Actual: ' + (e))  \n  }\n}\n",
    "id": "S11.2.3_A3_T1"
   },
   {
    "section": "11.2.3",
    "description": "Checking \"number primitive\" case",
    "test": "//CHECK#1\ntry {\n  1();\n    $ERROR('#1.1: 1() throw TypeError. Actual: ' + (1()));\t\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#1.2: 1() throw TypeError. Actual: ' + (e));\t\n  }\n}\n\n//CHECK#2\ntry {\n  var x = 1;\n  x();\n    $ERROR('#2.1: var x = 1; x() throw TypeError. Actual: ' + (x()));\t\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#2.2: var x = 1; x() throw TypeError. Actual: ' + (e));\t\n  }\n}\n",
    "id": "S11.2.3_A3_T2"
   },
   {
    "section": "11.2.3",
    "description": "Checking \"string primitive\" case",
    "test": "//CHECK#1\ntry {\n  \"1\"();\n    $ERROR('#1.1: \"1\"() throw TypeError. Actual: ' + (\"1\"()));\t\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#1.2: \"1\"() throw TypeError. Actual: ' + (e));\t\n  }\n}\n\n//CHECK#2\ntry {\n  var x = \"1\";\n  x();\n    $ERROR('#2.1: var x = \"1\"; x() throw TypeError. Actual: ' + (x()));\t\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#2.2: var x = \"1\"; x() throw TypeError. Actual: ' + (e));\t\n  }\n}\n",
    "id": "S11.2.3_A3_T3"
   },
   {
    "section": "11.2.3",
    "description": "Checking \"undefined\" case",
    "test": "//CHECK#1\ntry {\n  undefined();\n    $ERROR('#1.1: undefined() throw TypeError. Actual: ' + (e));\t\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#1.2: undefined() throw TypeError. Actual: ' + (e));\t\n  }\n}\n\n//CHECK#2\ntry {\n  var x = undefined;\n  x();\n    $ERROR('#2.1: var x = undefined; x() throw TypeError. Actual: ' + (e));\t\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#2.2: var x = undefined; x() throw TypeError. Actual: ' + (e));\t\n  }\n}\n",
    "id": "S11.2.3_A3_T4"
   },
   {
    "section": "11.2.3",
    "description": "Checking \"null\" case",
    "test": "//CHECK#1\ntry {\n  null();\n    $ERROR('#1.1: null() throw TypeError. Actual: ' + (null()));\t\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#1.2: null() throw TypeError. Actual: ' + (e));\t\n  }\n}\n\n//CHECK#2\ntry {\n  var x = null;\n  x();\n    $ERROR('#2.1: var x = null; x() throw TypeError. Actual: ' + (x()));\t\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#2.2: var x = null; x() throw TypeError. Actual: ' + (e));\t\n  }\n}\n",
    "id": "S11.2.3_A3_T5"
   },
   {
    "section": "11.2.3",
    "description": "Checking Boolean object case",
    "test": "//CHECK#1\ntry {\n  new Boolean(true)();\n  $ERROR('#1.1: new Boolean(true)() throw TypeError. Actual: ' + (new Boolean(true)()));  \n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#1.2: new Boolean(true)() throw TypeError. Actual: ' + (e));  \n  }\n}\n\n//CHECK#2\ntry {\n  var x = new Boolean(true);\n  x();\n  $ERROR('#2.1: var x = new Boolean(true); x() throw TypeError. Actual: ' + (x()));\t\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#2.2: var x = new Boolean(true); x() throw TypeError. Actual: ' + (e));\t\n  }\n}\n\n",
    "id": "S11.2.3_A4_T1"
   },
   {
    "section": "11.2.3",
    "description": "Checking Number object case",
    "test": "//CHECK#1\ntry {\n  new Number(1)();\n  $ERROR('#1.1: new Number(1)() throw TypeError. Actual: ' + (new Number(1)()));\t\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#1.2: new Number(1)() throw TypeError. Actual: ' + (e));\t\n  }\n}\n\n//CHECK#2\ntry {\n  var x = new Number(1);\n  x();\n  $ERROR('#2.1: var x = new Number(1); x() throw TypeError. Actual: ' + (x()));\t\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#2.2: var x = new Number(1); x() throw TypeError. Actual: ' + (e));\t\n  }\n}\n\n",
    "id": "S11.2.3_A4_T2"
   },
   {
    "section": "11.2.3",
    "description": "Checking String object case",
    "test": "//CHECK#1\ntry {\n  new String(\"1\")();\n  $ERROR('#1.1: new String(\"1\")() throw TypeError. Actual: ' + (new String(\"1\")()));\t\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#1.2: new String(\"1\")() throw TypeError. Actual: ' + (e));\t\n  }\n}\n\n//CHECK#2\ntry {\n  var x = new String(\"1\");\n  x();\n  $ERROR('#2.1: var x = new String(\"1\"); x() throw TypeError. Actual: ' + (x()));\t\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#2.2: var x = new String(\"1\"); x() throw TypeError. Actual: ' + (e));\t\n  }\n}\n",
    "id": "S11.2.3_A4_T3"
   },
   {
    "section": "11.2.3",
    "description": "Checking Global object case",
    "test": "//CHECK#1\ntry {\n  this();\n  $ERROR('#1.1: this() throw TypeError. Actual: ' + (this()));\t\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#1.2: this() throw TypeError. Actual: ' + (e));\t\n  }\n}\n",
    "id": "S11.2.3_A4_T4"
   },
   {
    "section": "11.2.3",
    "description": "Checking Math object case",
    "test": "//CHECK#1\ntry {\n  Math();\n  $ERROR('#1.1: Math() throw TypeError. Actual: ' + (Math()));\t\n}\ncatch (e) {\n  if ((e instanceof TypeError) !== true) {\n    $ERROR('#1.2: Math() throw TypeError. Actual: ' + (e));\t\n  }\n}\n\n",
    "id": "S11.2.3_A4_T5"
   }
  ]
 }
}