aboutsummaryrefslogtreecommitdiffstats
path: root/website/resources/scripts/testcases2/11.2.2_The_new_Operator.json
diff options
context:
space:
mode:
Diffstat (limited to 'website/resources/scripts/testcases2/11.2.2_The_new_Operator.json')
-rw-r--r--website/resources/scripts/testcases2/11.2.2_The_new_Operator.json86
1 files changed, 86 insertions, 0 deletions
diff --git a/website/resources/scripts/testcases2/11.2.2_The_new_Operator.json b/website/resources/scripts/testcases2/11.2.2_The_new_Operator.json
new file mode 100644
index 000000000..17bf0ad0a
--- /dev/null
+++ b/website/resources/scripts/testcases2/11.2.2_The_new_Operator.json
@@ -0,0 +1,86 @@
+{
+ "testCollection": {
+ "name": "11.2.2_The_new_Operator",
+ "numTests": 13,
+ "tests": [
+ {
+ "section": "11.2.2, 7.2, 7.3",
+ "description": "Checking by using eval",
+ "test": "//CHECK#1\nif (eval(\"new\\u0009Number\") != 0) {\n $ERROR('#1: new\\\\u0009Number == 0');\n}\n\n//CHECK#2\nif (eval(\"new\\u000BNumber\") != 0) {\n $ERROR('#2: new\\\\u000BNumber == 0'); \n}\n\n//CHECK#3\nif (eval(\"new\\u000CNumber\") != 0) {\n $ERROR('#3: new\\\\u000CNumber == 0');\n}\n\n//CHECK#4\nif (eval(\"new\\u0020Number\") != 0) {\n $ERROR('#4: new\\\\u0020Number == 0');\n}\n\n//CHECK#5\nif (eval(\"new\\u00A0Number\") != 0) {\n $ERROR('#5: new\\\\u00A0Number == 0');\n}\n\n//CHECK#6\nif (eval(\"new\\u000ANumber\") != 0) {\n $ERROR('#6: new\\\\u000ANumber == 0'); \n}\n\n//CHECK#7\nif (eval(\"new\\u000DNumber\") != 0) {\n $ERROR('#7: new\\\\u000DNumber == 0');\n}\n\n//CHECK#8\nif (eval(\"new\\u2028Number\") != 0) {\n $ERROR('#8: new\\\\u2028Number == 0');\n}\n\n//CHECK#9\nif (eval(\"new\\u2029Number\") != 0) {\n $ERROR('#9: new\\\\u2029Number == 0');\n}\n\n//CHECK#10\nif (eval(\"new\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029Number\") != 0) {\n $ERROR('#10: new\\\\u0009\\\\u000B\\\\u000C\\\\u0020\\\\u00A0\\\\u000A\\\\u000D\\\\u2028\\\\u2029Number == 0');\n}\n",
+ "id": "S11.2.2_A1.1"
+ },
+ {
+ "section": "11.2.2, 7.2, 7.3",
+ "description": "Checking by using eval",
+ "test": "//CHECK#1\nif (eval(\"new\\u0009Number()\") != 0) {\n $ERROR('#1: new\\\\u0009Number == 0');\n}\n\n//CHECK#2\nif (eval(\"new\\u000BNumber()\") != 0) {\n $ERROR('#2: new\\\\u000BNumber == 0'); \n}\n\n//CHECK#3\nif (eval(\"new\\u000CNumber()\") != 0) {\n $ERROR('#3: new\\\\u000CNumber == 0');\n}\n\n//CHECK#4\nif (eval(\"new\\u0020Number()\") != 0) {\n $ERROR('#4: new\\\\u0020Number == 0');\n}\n\n//CHECK#5\nif (eval(\"new\\u00A0Number()\") != 0) {\n $ERROR('#5: new\\\\u00A0Number == 0');\n}\n\n//CHECK#6\nif (eval(\"new\\u000ANumber()\") != 0) {\n $ERROR('#6: new\\\\u000ANumber == 0'); \n}\n\n//CHECK#7\nif (eval(\"new\\u000DNumber()\") != 0) {\n $ERROR('#7: new\\\\u000DNumber == 0');\n}\n\n//CHECK#8\nif (eval(\"new\\u2028Number()\") != 0) {\n $ERROR('#8: new\\\\u2028Number == 0');\n}\n\n//CHECK#9\nif (eval(\"new\\u2029Number()\") != 0) {\n $ERROR('#9: new\\\\u2029Number == 0');\n}\n\n//CHECK#10\nif (eval(\"new\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029Number()\") != 0) {\n $ERROR('#10: new\\\\u0009\\\\u000B\\\\u000C\\\\u0020\\\\u00A0\\\\u000A\\\\u000D\\\\u2028\\\\u2029Number == 0');\n}\n",
+ "id": "S11.2.2_A1.2"
+ },
+ {
+ "section": "11.2.2",
+ "description": "If GetBase(NewExpression) or GetBase(MemberExpression) is null, throw ReferenceError",
+ "test": "//CHECK#1\ntry {\n new x;\n $ERROR('#1.1: new x throw ReferenceError. Actual: ' + (new x)); \n}\ncatch (e) {\n if ((e instanceof ReferenceError) !== true) {\n $ERROR('#1.2: new x throw ReferenceError. Actual: ' + (e)); \n }\n}\n\n//CHECK#2\ntry {\n new x();\n $ERROR('#2: new x() throw ReferenceError'); \n}\ncatch (e) {\n if ((e instanceof ReferenceError) !== true) {\n $ERROR('#2: new x() throw ReferenceError'); \n }\n}\n",
+ "id": "S11.2.2_A2"
+ },
+ {
+ "section": "11.2.2",
+ "description": "Checking boolean primitive case",
+ "test": "//CHECK#1\ntry {\n new true;\n $ERROR('#1: new true throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#1: new true throw TypeError');\t\n }\n}\n\n//CHECK#2\ntry {\n var x = true;\n new x;\n $ERROR('#2: var x = true; new x throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#2: var x = true; new x throw TypeError');\t\n }\n}\n\n//CHECK#3\ntry {\n var x = true;\n new x();\n $ERROR('#3: var x = true; new x() throw TypeError'); \n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#3: var x = true; new x() throw TypeError'); \n }\n}\n\n",
+ "id": "S11.2.2_A3_T1"
+ },
+ {
+ "section": "11.2.2",
+ "description": "Checking \"number primitive\" case",
+ "test": "//CHECK#1\ntry {\n new 1;\n $ERROR('#1: new 1 throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#1: new 1 throw TypeError');\t\n }\n}\n\n//CHECK#2\ntry {\n var x = 1;\n new x;\n $ERROR('#2: var x = 1; new x throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#2: var x = 1; new x throw TypeError');\t\n }\n}\n\n//CHECK#3\ntry {\n var x = 1;\n new x();\n $ERROR('#3: var x = 1; new x() throw TypeError'); \n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#3: var x = 1; new x() throw TypeError'); \n }\n}\n",
+ "id": "S11.2.2_A3_T2"
+ },
+ {
+ "section": "11.2.2",
+ "description": "Checking \"string primitive\" case",
+ "test": "//CHECK#1\ntry {\n new 1;\n $ERROR('#1: new \"1\" throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#1: new \"1\" throw TypeError');\t\n }\n}\n\n//CHECK#2\ntry {\n var x = \"1\";\n new x;\n $ERROR('#2: var x = \"1\"; new x throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#2: var x = \"1\"; new x throw TypeError');\t\n }\n}\n\n//CHECK#3\ntry {\n var x = \"1\";\n new x();\n $ERROR('#3: var x = \"1\"; new x() throw TypeError'); \n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#3: var x = \"1\"; new x() throw TypeError'); \n }\n}\n",
+ "id": "S11.2.2_A3_T3"
+ },
+ {
+ "section": "11.2.2",
+ "description": "Checking \"undefined\" case",
+ "test": "//CHECK#1\ntry {\n new undefined;\n $ERROR('#1: new undefined throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#1: new undefined throw TypeError');\t\n }\n}\n\n//CHECK#2\ntry {\n var x = undefined;\n new x;\n $ERROR('#2: var x = undefined; new x throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#2: var x = undefined; new x throw TypeError');\t\n }\n}\n\n//CHECK#3\ntry {\n var x = undefined;\n new x();\n $ERROR('#3: var x = undefined; new x() throw TypeError'); \n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#3: var x = undefined; new x() throw TypeError'); \n }\n}\n",
+ "id": "S11.2.2_A3_T4"
+ },
+ {
+ "section": "11.2.2",
+ "description": "Checking \"null primitive\" case",
+ "test": "//CHECK#1\ntry {\n new null;\n $ERROR('#1: new null throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#1: new null throw TypeError');\t\n }\n}\n\n//CHECK#2\ntry {\n var x = null;\n new x;\n $ERROR('#2: var x = null; new x throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#2: var x = null; new x throw TypeError');\t\n }\n}\n\n//CHECK#3\ntry {\n var x = null;\n new x();\n $ERROR('#3: var x = null; new x() throw TypeError'); \n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#3: var x = null; new x() throw TypeError'); \n }\n}\n",
+ "id": "S11.2.2_A3_T5"
+ },
+ {
+ "section": "11.2.2",
+ "description": "Checking Boolean object case",
+ "test": "//CHECK#1\ntry {\n new new Boolean(true);\n $ERROR('#1: new new Boolean(true) throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#1: new new Boolean(true) throw TypeError');\t\n }\n}\n\n//CHECK#2\ntry {\n var x = new Boolean(true);\n new x;\n $ERROR('#2: var x = new Boolean(true); new x throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#2: var x = new Boolean(true); new x throw TypeError');\t\n }\n}\n\n//CHECK#3\ntry {\n var x = new Boolean(true);\n new x();\n $ERROR('#3: var x = new Boolean(true); new x() throw TypeError'); \n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#3: var x = new Boolean(true); new x() throw TypeError'); \n }\n}\n\n",
+ "id": "S11.2.2_A4_T1"
+ },
+ {
+ "section": "11.2.2",
+ "description": "Checking Number object case",
+ "test": "//CHECK#1\ntry {\n new new Number(1);\n $ERROR('#1: new new Number(1) throw TypeError');\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#1: new new Number(1) throw TypeError');\n }\n}\n\n//CHECK#2\ntry {\n var x = new Number(1);\n new x;\n $ERROR('#2: var x = new Number(1); new x throw TypeError');\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#2: var x = new Number(1); new x throw TypeError');\n }\n}\n\n//CHECK#3\ntry {\n var x = new Number(1);\n new x();\n $ERROR('#3: var x = new Number(1); new x() throw TypeError');\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#3: var x = new Number(1); new x() throw TypeError');\n }\n}\n\n",
+ "id": "S11.2.2_A4_T2"
+ },
+ {
+ "section": "11.2.2",
+ "description": "Checking String object case",
+ "test": "//CHECK#1\ntry {\n new new String(\"1\");\n $ERROR('#1: new new String(\"1\") throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#1: new new String(\"1\") throw TypeError');\t\n }\n}\n\n//CHECK#2\ntry {\n var x = new String(\"1\");\n new x;\n $ERROR('#2: var x = new String(\"1\"); new x throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#2: var x = new String(\"1\"); new x throw TypeError');\t\n }\n}\n\n//CHECK#3\ntry {\n var x = new String(\"1\");\n new x();\n $ERROR('#3: var x = new String(\"1\"); new x() throw TypeError'); \n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#3: var x = new String(\"1\"); new x() throw TypeError'); \n }\n}\n\n",
+ "id": "S11.2.2_A4_T3"
+ },
+ {
+ "section": "11.2.2",
+ "description": "Checking Global object case",
+ "test": "//CHECK#1\ntry {\n new this;\n $ERROR('#1: new this throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#1: new this throw TypeError');\t\n }\n}\n\n//CHECK#2\ntry {\n new this();\n $ERROR('#2: new this() throw TypeError'); \n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#2: new this() throw TypeError'); \n }\n}\n",
+ "id": "S11.2.2_A4_T4"
+ },
+ {
+ "section": "11.2.2",
+ "description": "Checking Math object case",
+ "test": "//CHECK#1\ntry {\n new Math;\n $ERROR('#1: new Math throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#1: new Math throw TypeError');\t\n }\n}\n\n//CHECK#2\ntry {\n new new Math();\n $ERROR('#2: new new Math() throw TypeError');\t\n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#2: new new Math() throw TypeError');\t\n }\n}\n\n//CHECK#3\ntry {\n var x = new Math();\n new x();\n $ERROR('#3: var x = new Math(); new x() throw TypeError'); \n}\ncatch (e) {\n if ((e instanceof TypeError) !== true) {\n $ERROR('#3: var x = new Math(); new x() throw TypeError'); \n }\n}\n\n",
+ "id": "S11.2.2_A4_T5"
+ }
+ ]
+ }
+}