mirror of https://github.com/tc39/test262.git
65 lines
8.0 KiB
JSON
65 lines
8.0 KiB
JSON
{
|
|
"testCollection": {
|
|
"name": "11.1.5_Object_Initializer",
|
|
"numTests": 9,
|
|
"tests": [
|
|
{
|
|
"section": "11.1.5",
|
|
"description": "Checking various properteis of the object defined with \"var object = {}\"",
|
|
"test": "var object = {};\n\n//CHECK#1\nif (typeof object !== \"object\") {\n $ERROR('#1: var object = {}; typeof object === \"object\". Actual: ' + (typeof object));\n}\n\n//CHECK#2\nif (object instanceof Object !== true) {\n $ERROR('#2: var object = {}; object instanceof Object === true');\n}\n\n//CHECK#3\nif (object.toString !== Object.prototype.toString) {\n $ERROR('#3: var object = {}; object.toString === Object.prototype.toString. Actual: ' + (object.toString));\n}\n\n//CHECK#4\nif (object.toString() !== \"[object Object]\") {\n $ERROR('#4: var object = {}; object.toString === \"[object Object]\". Actual: ' + (object.toString));\n}\n",
|
|
"id": "S11.1.5_A1.1"
|
|
},
|
|
{
|
|
"section": "11.1.5",
|
|
"description": "Checking various properteis and contents of the object defined with \"var object = {1 : true}\"",
|
|
"test": "var object = {1 : true};\n\n//CHECK#1\nif (typeof object !== \"object\") {\n $ERROR('#1: var object = {1 : true}; typeof object === \"object\". Actual: ' + (typeof object));\n}\n\n//CHECK#2\nif (object instanceof Object !== true) {\n $ERROR('#2: var object = {1 : true}; object instanceof Object === true');\n}\n\n//CHECK#3\nif (object.toString !== Object.prototype.toString) {\n $ERROR('#3: var object = {1 : true}; object.toString === Object.prototype.toString. Actual: ' + (object.toString));\n}\n\n//CHECK#4\nif (object[1] !== true) {\n $ERROR('#4: var object = {1 : true}; object[1] === true');\n}\n\n//CHECK#5\nif (object[\"1\"] !== true) {\n $ERROR('#5: var object = {1 : true}; object[\"1\"] === true');\n}\n\n",
|
|
"id": "S11.1.5_A1.2"
|
|
},
|
|
{
|
|
"section": "11.1.5",
|
|
"description": "Checking various properteis and contents of the object defined with \"var object = {\"x\" : true}\"",
|
|
"test": "var object = {\"x\" : true};\n\n//CHECK#1\nif (typeof object !== \"object\") {\n $ERROR('#1: var object = {\"x\" : true}; typeof object === \"object\". Actual: ' + (typeof object));\n}\n\n//CHECK#2\nif (object instanceof Object !== true) {\n $ERROR('#2: var object = {\"x\" : true}; object instanceof Object === true');\n}\n\n//CHECK#3\nif (object.toString !== Object.prototype.toString) {\n $ERROR('#3: var object = {\"x\" : true}; object.toString === Object.prototype.toString. Actual: ' + (object.toString));\n}\n\n//CHECK#4\nif (object[\"x\"] !== true) {\n $ERROR('#4: var object = {\"x\" : true}; object[\"x\"] === true');\n}\n\n//CHECK#5\nif (object.x !== true) {\n $ERROR('#5: var object = {\"x\" : true}; object.x === true');\n}\n",
|
|
"id": "S11.1.5_A1.3"
|
|
},
|
|
{
|
|
"section": "11.1.5",
|
|
"description": "Checking various properteis and contents of the object defined with \"var object = {prop : true}\"",
|
|
"test": "var object = {prop : true};\n\n//CHECK#1\nif (typeof object !== \"object\") {\n $ERROR('#1: var object = {prop : true}; typeof object === \"object\". Actual: ' + (typeof object));\n}\n\n//CHECK#2\nif (object instanceof Object !== true) {\n $ERROR('#2: var object = {prop : true}; object instanceof Object === true');\n}\n\n//CHECK#3\nif (object.toString !== Object.prototype.toString) {\n $ERROR('#3: var object = {prop : true}; object.toString === Object.prototype.toString. Actual: ' + (object.toString));\n}\n\n//CHECK#4\nif (object[\"prop\"] !== true) {\n $ERROR('#4: var object = {prop : true}; object[\"prop\"] === true');\n}\n\n//CHECK#5\nif (object.prop !== true) {\n $ERROR('#5: var object = {prop : true}; object.prop === true');\n}\n",
|
|
"id": "S11.1.5_A1.4"
|
|
},
|
|
{
|
|
"section": "11.1.5",
|
|
"description": "Creating property \"prop\" of various types(boolean, number and etc.)",
|
|
"test": "//CHECK#1\nvar x = true;\nvar object = {prop : x}; \nif (object.prop !== x) {\n $ERROR('#1: var x = true; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));\n}\n\n//CHECK#2\nvar x = new Boolean(true);\nvar object = {prop : x}; \nif (object.prop !== x) {\n $ERROR('#2: var x = new Boolean(true); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));\n}\n\n//CHECK#3\nvar x = 1;\nvar object = {prop : x}; \nif (object.prop !== x) {\n $ERROR('#3: var x = 1; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));\n}\n\n//CHECK#4\nvar x = new Number(1);\nvar object = {prop : x}; \nif (object.prop !== x) {\n $ERROR('#4: var x = new Number(1); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));\n}\n\n//CHECK#5\nvar x = \"1\";\nvar object = {prop : x}; \nif (object.prop !== x) {\n $ERROR('#5: var x = \"1\"; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));\n}\n\n//CHECK#6\nvar x = new String(1);\nvar object = {prop : x}; \nif (object.prop !== x) {\n $ERROR('#6: var x = new String(1); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));\n}\n\n//CHECK#7\nvar x = undefined;\nvar object = {prop : x}; \nif (object.prop !== x) {\n $ERROR('#7: var x = undefined; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));\n}\n\n//CHECK#8\nvar x = null;\nvar object = {prop : x}; \nif (object.prop !== x) {\n $ERROR('#8: var x = null; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));\n}\n\n//CHECK#9\nvar x = {};\nvar object = {prop : x}; \nif (object.prop !== x) {\n $ERROR('#9: var x = {}; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));\n}\n\n//CHECK#10\nvar x = [1,2];\nvar object = {prop : x}; \nif (object.prop !== x) {\n $ERROR('#10: var x = [1,2]; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));\n}\n\n//CHECK#11\nvar x = function() {};\nvar object = {prop : x}; \nif (object.prop !== x) {\n $ERROR('#11: var x = function() {}; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));\n}\n\n//CHECK#12\nvar x = this;\nvar object = {prop : x}; \nif (object.prop !== x) {\n $ERROR('#12: var x = this; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop));\n}\n",
|
|
"id": "S11.1.5_A2"
|
|
},
|
|
{
|
|
"section": "11.1.5",
|
|
"description": "Creating the object defined with \"var object = {0 : 1, \"1\" : \"x\", o : {}}\"",
|
|
"test": "var object = {0 : 1, \"1\" : \"x\", o : {}};\n\n//CHECK#1\nif (object[0] !== 1) {\n $ERROR('#1: var object = {0 : 1; \"1\" : \"x\"; o : {}}; object[0] === 1. Actual: ' + (object[0]));\n}\n\n//CHECK#2\nif (object[\"1\"] !== \"x\") {\n $ERROR('#2: var object = {0 : 1; \"1\" : \"x\"; o : {}}; object[\"1\"] === \"x\". Actual: ' + (object[\"1\"]));\n}\n\n//CHECK#3\nif (typeof object.o !== \"object\") {\n $ERROR('#1: var object = {0 : 1; \"1\" : \"x\"; o : {}}; typeof object.o === \"object\". Actual: ' + (typeof object.o));\n}\n",
|
|
"id": "S11.1.5_A3"
|
|
},
|
|
{
|
|
"section": "11.1.5",
|
|
"description": "Checking if execution of \"var object = {true : 1}\" fails",
|
|
"negative": "",
|
|
"test": "//CHECK#1\nvar object = {true : 1};\n",
|
|
"id": "S11.1.5_A4.1"
|
|
},
|
|
{
|
|
"section": "11.1.5",
|
|
"description": "Checking if execution of \"var object = {null : true}\" fails",
|
|
"negative": "",
|
|
"test": "//CHECK#1\nvar object = {null : true};\n",
|
|
"id": "S11.1.5_A4.2"
|
|
},
|
|
{
|
|
"section": "11.1.5",
|
|
"description": "Creating properties with following names: undefined, 'true', 'null'",
|
|
"test": "//CHECK#1\nvar object = {undefined : true};\nif (object.undefined !== true) {\n $ERROR('#1: var object = {undefined : true}; object.undefined === true');\n}\n\n//CHECK#2\nvar object = {undefined : true};\nif (object[\"undefined\"] !== true) {\n $ERROR('#2: var object = {undefined : true}; object[\"undefined\"] === true');\n}\n\n//CHECK#3\nvar object = {\"true\" : true};\nif (object[\"true\"] !== true) {\n $ERROR('#3: var object = {\"true\" : true}; object[\"true\"] === true');\n}\n\n//CHECK#4\nvar object = {\"null\" : true};\nif (object[\"null\"] !== true) {\n $ERROR('#4: var object = {\"null\" : true}; object[\"null\"] === true');\n}\n",
|
|
"id": "S11.1.5_A4.3"
|
|
}
|
|
]
|
|
}
|
|
}
|