aboutsummaryrefslogtreecommitdiffstats
path: root/website/resources/scripts/testcases2/11.13.1_Simple_Assignment.json
blob: 70954ea399522115da27eb7f3f026bcd894d3751 (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
{
 "testCollection": {
  "name": "11.13.1_Simple_Assignment",
  "numTests": 8,
  "tests": [
   {
    "section": "11.13.1",
    "description": "Checking by using eval",
    "test": "//CHECK#1\nif ((eval(\"x\\u0009=\\u0009true\")) !== true) {\n  $ERROR('#1: (x\\\\u0009=\\\\u0009true) === true');\n}\n\n//CHECK#2\nif ((eval(\"x\\u000B=\\u000Btrue\")) !== true) {\n  $ERROR('#2: (x\\\\u000B=\\\\u000Btrue) === true');  \n}\n\n//CHECK#3\nif ((eval(\"x\\u000C=\\u000Ctrue\")) !== true) {\n  $ERROR('#3: (x\\\\u000C=\\\\u000Ctrue) === true');\n}\n\n//CHECK#4\nif ((eval(\"x\\u0020=\\u0020true\")) !== true) {\n  $ERROR('#4: (x\\\\u0020=\\\\u0020true) === true');\n}\n\n//CHECK#5\nif ((eval(\"x\\u00A0=\\u00A0true\")) !== true) {\n  $ERROR('#5: (x\\\\u00A0=\\\\u00A0true) === true');\n}\n\n//CHECK#6\nif ((eval(\"x\\u000A=\\u000Atrue\")) !== true) {\n  $ERROR('#6: (x\\\\u000A=\\\\u000Atrue) === true');  \n}\n\n//CHECK#7\nif ((eval(\"x\\u000D=\\u000Dtrue\")) !== true) {\n  $ERROR('#7: (x\\\\u000D=\\\\u000Dtrue) === true');\n}\n\n//CHECK#8\nif ((eval(\"x\\u2028=\\u2028true\")) !== true) {\n  $ERROR('#8: (x\\\\u2028=\\\\u2028true) === true');\n}\n\n//CHECK#9\nif ((eval(\"x\\u2029=\\u2029true\")) !== true) {\n  $ERROR('#9: (x\\\\u2029=\\\\u2029true) === true');\n}\n\n\n//CHECK#10\nif ((eval(\"x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029true\")) !== true) {\n  $ERROR('#10: (x\\\\u0009\\\\u000B\\\\u000C\\\\u0020\\\\u00A0\\\\u000A\\\\u000D\\\\u2028\\\\u2029=\\\\u0009\\\\u000B\\\\u000C\\\\u0020\\\\u00A0\\\\u000A\\\\u000D\\\\u2028\\\\u2029true) === true');\n}\n",
    "id": "S11.13.1_A1"
   },
   {
    "section": "11.13.1",
    "description": "Either AssigmentExpression is not Reference or GetBase is not null",
    "test": "//CHECK#1\nx = 1;\nif (x !== 1) {\n  $ERROR('#1: x = 1; x === 1. Actual: ' + (x));\n}\n\n//CHECK#2\nvar x = 1;\nif (x !== 1) {\n  $ERROR('#2: var x = 1; x === 1. Actual: ' + (x));\n}\n\n//CHECK#3\ny = 1;\nx = y;\nif (x !== 1) {\n  $ERROR('#3: y = 1; x = y; x === 1. Actual: ' + (x));\n}\n\n//CHECK#4\nvar y = 1;\nvar x = y;\nif (x !== 1) {\n  $ERROR('#4: var y = 1; var x = y; x === 1. Actual: ' + (x));\n}\n\n//CHECK#5\nvar objectx = new Object();\nvar objecty = new Object();\nobjecty.prop = 1.1;\nobjectx.prop = objecty.prop;\nif (objectx.prop !== objecty.prop) {\n  $ERROR('#5: var objectx = new Object(); var objecty = new Object(); objecty.prop = 1; objectx.prop = objecty.prop; objectx.prop === objecty.prop. Actual: ' + (objectx.prop));\n} else {\n  if (objectx === objecty) {\n    $ERROR('#5: var objectx = new Object(); var objecty = new Object(); objecty.prop = 1; objectx.prop = objecty.prop; objectx !== objecty');\n  } \n}\n\n",
    "id": "S11.13.1_A2.1_T1"
   },
   {
    "section": "11.13.1",
    "description": "If GetBase(AssigmentExpression) is null, throw ReferenceError",
    "test": "//CHECK#1\ntry {\n  x = y;\n  $ERROR('#1.1: x = y throw ReferenceError. Actual: ' + (x = y));  \n}\ncatch (e) {\n  if ((e instanceof ReferenceError) !== true) {\n    $ERROR('#1.2: x = y throw ReferenceError. Actual: ' + (e));  \n  }\n}\n",
    "id": "S11.13.1_A2.1_T2"
   },
   {
    "section": "11.13.1, 16",
    "description": "If Type(LeftHandSideExpression) is not Reference, throw ReferenceError (or SyntaxError)",
    "negative": "",
    "test": "//CHECK#1\ntry {\n  1 = 1;\n  $ERROR('#1.1: 1 = 1 throw ReferenceError (or SyntaxError). Actual: ' + (1 = 1));  \n}\ncatch (e) {\n  if ((e instanceof ReferenceError) !== true) {\n    $ERROR('#1.2: 1 = 1 throw ReferenceError (or SyntaxError). Actual: ' + (e));  \n  } else {\n    1 = 1;\n  }\n}\n",
    "id": "S11.13.1_A2.1_T3"
   },
   {
    "section": "11.13.1",
    "description": "Checking Expression and Variable statements",
    "test": "//CHECK#1\nvar x = 1;\nif (x !== 1) {\n  $ERROR('#1: var x = 1; x === 1. Actual: ' + (x));\n}\n\n//CHECK#2\ny = 1;\nif (y !== 1) {\n  $ERROR('#2: y = 1; y === 1. Actual: ' + (y));\n}\n",
    "id": "S11.13.1_A3.1"
   },
   {
    "section": "11.13.1",
    "description": "Checking Expression and Variable statements",
    "test": "//CHECK#1\nvar x = 0;\nif ((x = 1) !== 1) {\n  $ERROR('#1: var x = 0; (x = 1) === 1. Actual: ' + ((x = 1)));\n}\n\n//CHECK#2\nx = 0;\nif ((x = 1) !== 1) {\n  $ERROR('#2: x = 0; (x = 1) === 1. Actual: ' + ((x = 1)));\n}\n",
    "id": "S11.13.1_A3.2"
   },
   {
    "section": "11.13.1",
    "description": "Syntax check",
    "test": "//CHECK#1\nx = x = 1;\nif (x !== 1) {\n  $ERROR('#1: The expression x = x = 1 is the same x = (x = 1), not (x = x) = 1. Actual: ' + (x));\n}\n\n\n",
    "id": "S11.13.1_A4_T1"
   },
   {
    "section": "11.13.1",
    "description": "Syntax check if \"x = x\" throws ReferenceError",
    "test": "//CHECK#1\ntry {\n  x = x;\n  $ERROR('#1.1: x = x throw ReferenceError. Actual: ' + (x = x));\n} catch(e) {\n  if ((e instanceof ReferenceError) !== true) {\n    $ERROR('#1.2: x = x throw ReferenceError. Actual: ' + (e));  \n  }\n}\n\n\n",
    "id": "S11.13.1_A4_T2"
   }
  ]
 }
}