mirror of https://github.com/tc39/test262.git
119 lines
8.5 KiB
JSON
119 lines
8.5 KiB
JSON
{
|
|
"testCollection": {
|
|
"name": "11.13.1",
|
|
"numTests": 15,
|
|
"tests": [
|
|
{
|
|
"id": "11.13.1-1-1",
|
|
"path": "TestCases/chapter11/11.13/11.13.1/11.13.1-1-1.js",
|
|
"description": "simple assignment throws ReferenceError if LeftHandSide is not a reference (number)",
|
|
"test": "assertTrue((function testcase() {\n try {\n eval(\"42 = 42\");\n }\n catch (e) {\n if (e instanceof ReferenceError) {\n return true;\n }\n }\n }).call(this));\n"
|
|
},
|
|
{
|
|
"id": "11.13.1-1-2",
|
|
"path": "TestCases/chapter11/11.13/11.13.1/11.13.1-1-2.js",
|
|
"description": "simple assignment throws ReferenceError if LeftHandSide is not a reference (string)",
|
|
"test": "assertTrue((function testcase() {\n try {\n eval(\"'x' = 42\");\n }\n catch (e) {\n if (e instanceof ReferenceError) {\n return true;\n }\n }\n }).call(this));\n"
|
|
},
|
|
{
|
|
"id": "11.13.1-1-3",
|
|
"path": "TestCases/chapter11/11.13/11.13.1/11.13.1-1-3.js",
|
|
"description": "simple assignment throws ReferenceError if LeftHandSide is not a reference (boolean)",
|
|
"test": "assertTrue((function testcase() {\n try {\n eval(\"true = 42\");\n }\n catch (e) {\n if (e instanceof ReferenceError) {\n return true;\n }\n }\n }).call(this));\n"
|
|
},
|
|
{
|
|
"id": "11.13.1-1-4",
|
|
"path": "TestCases/chapter11/11.13/11.13.1/11.13.1-1-4.js",
|
|
"description": "simple assignment throws ReferenceError if LeftHandSide is not a reference (null)",
|
|
"test": "assertTrue((function testcase() {\n try {\n eval(\"null = 42\");\n }\n catch (e) {\n if (e instanceof ReferenceError) {\n return true;\n }\n }\n }).call(this));\n"
|
|
},
|
|
{
|
|
"id": "11.13.1-1-6-s",
|
|
"path": "TestCases/chapter11/11.13/11.13.1/11.13.1-1-6-s.js",
|
|
"description": "simple assignment throws ReferenceError if LeftHandSide is an unresolvable reference in strict mode (base obj undefined)",
|
|
"test": "assertTrue((function testcase() {\n 'use strict';\n \n try {\n __ES3_1_test_suite_test_11_13_1_unique_id_0__.x = 42;\n return false;\n }\n catch (e) {\n return (e instanceof ReferenceError);\n }\n }).call(this));\n",
|
|
"strict_only": ""
|
|
},
|
|
{
|
|
"id": "11.13.1-1-s",
|
|
"path": "TestCases/chapter11/11.13/11.13.1/11.13.1-1-s.js",
|
|
"description": "Strict Mode - TypeError is thrown if The LeftHandSide is a reference to a data property with the attribute value {[[Writable]]:false} under strict mode",
|
|
"test": "assertTrue((function testcase() {\n \"use strict\";\n var obj = {};\n Object.defineProperty(obj, \"prop\", {\n value: 10,\n writable: false,\n enumerable: true,\n configurable: true\n });\n\n try {\n obj.prop = 20;\n return false;\n } catch (e) {\n return e instanceof TypeError && obj.prop === 10;\n }\n }).call(this));\n",
|
|
"precondition": "(fnSupportsStrict())",
|
|
"strict_only": ""
|
|
},
|
|
{
|
|
"id": "11.13.1-2-s",
|
|
"path": "TestCases/chapter11/11.13/11.13.1/11.13.1-2-s.js",
|
|
"description": "Strict Mode - TypeError is thrown if The LeftHandSide is a reference to an accessor property with the attribute value {[[Set]]:undefined} under strict mode",
|
|
"test": "assertTrue((function testcase() {\n \"use strict\";\n var obj = {};\n Object.defineProperty(obj, \"prop\", {\n get: function () {\n return 11;\n },\n set: undefined,\n enumerable: true,\n configurable: true\n });\n\n try {\n obj.prop = 20;\n return false;\n } catch (e) {\n return e instanceof TypeError && obj.prop === 11;\n }\n }).call(this));\n",
|
|
"precondition": "(fnSupportsStrict())",
|
|
"strict_only": ""
|
|
},
|
|
{
|
|
"id": "11.13.1-3-s",
|
|
"path": "TestCases/chapter11/11.13/11.13.1/11.13.1-3-s.js",
|
|
"description": "Strict Mode - TypeError is thrown if The LeftHandSide is a reference to a non-existent property of an object whose [[Extensible]] internal property has the value false under strict mode",
|
|
"test": "assertTrue((function testcase() {\n \"use strict\";\n var obj = {};\n Object.preventExtensions(obj);\n\n try {\n obj.len = 10;\n return false;\n } catch (e) {\n return e instanceof TypeError;\n }\n }).call(this));\n",
|
|
"precondition": "(fnSupportsStrict())",
|
|
"strict_only": ""
|
|
},
|
|
{
|
|
"id": "11.13.1-4-1",
|
|
"path": "TestCases/chapter11/11.13/11.13.1/11.13.1-4-1.js",
|
|
"description": "simple assignment creates property on the global object if LeftHandSide is an unresolvable reference",
|
|
"test": "assertTrue((function testcase() {\n function foo() {\n __ES3_1_test_suite_test_11_13_1_unique_id_3__ = 42;\n }\n foo();\n\n var desc = Object.getOwnPropertyDescriptor(fnGlobalObject(), '__ES3_1_test_suite_test_11_13_1_unique_id_3__');\n if (desc.value === 42 &&\n desc.writable === true &&\n desc.enumerable === true &&\n desc.configurable === true) {\n delete __ES3_1_test_suite_test_11_13_1_unique_id_3__;\n return true;\n } \n }).call(this));\n",
|
|
"precondition": "(fnExists(Object.getOwnPropertyDescriptor))"
|
|
},
|
|
{
|
|
"id": "11.13.1-4-14-s",
|
|
"path": "TestCases/chapter11/11.13/11.13.1/11.13.1-4-14-s.js",
|
|
"description": "simple assignment throws TypeError if LeftHandSide is a readonly property in strict mode (Number.MAX_VALUE)",
|
|
"test": "assertTrue((function testcase() {\n 'use strict';\n\n try {\n Number.MAX_VALUE = 42;\n return false;\n }\n catch (e) {\n return (e instanceof TypeError);\n }\n }).call(this));\n",
|
|
"precondition": "(fnSupportsStrict())",
|
|
"strict_only": ""
|
|
},
|
|
{
|
|
"id": "11.13.1-4-27-s",
|
|
"path": "TestCases/chapter11/11.13/11.13.1/11.13.1-4-27-s.js",
|
|
"description": "simple assignment throws TypeError if LeftHandSide is a readonly property in strict mode (Global.undefined)",
|
|
"test": "assertTrue((function testcase() {\n 'use strict';\n\n try {\n fnGlobalObject().undefined = 42;\n return false;\n }\n catch (e) {\n return (e instanceof TypeError);\n }\n }).call(this));\n",
|
|
"precondition": "(fnSupportsStrict())",
|
|
"strict_only": ""
|
|
},
|
|
{
|
|
"id": "11.13.1-4-28-s",
|
|
"path": "TestCases/chapter11/11.13/11.13.1/11.13.1-4-28-s.js",
|
|
"description": "Strict Mode - SyntaxError is thrown if the identifier 'eval' appears as the LeftHandSideExpression of simple assignment(=) under strict mode",
|
|
"test": "assertTrue((function testcase() {\n \"use strict\";\n var blah = eval;\n try {\n eval(\"var eval = 20;\");\n return false;\n } catch (e) {\n return e instanceof SyntaxError && blah === eval;\n }\n }).call(this));\n",
|
|
"precondition": "(fnSupportsStrict())",
|
|
"strict_only": ""
|
|
},
|
|
{
|
|
"id": "11.13.1-4-29-s",
|
|
"path": "TestCases/chapter11/11.13/11.13.1/11.13.1-4-29-s.js",
|
|
"description": "Strict Mode - SyntaxError is thrown if the identifier 'arguments' appears as the LeftHandSideExpression of simple assignment(=) under strict mode",
|
|
"test": "assertTrue((function testcase() {\n \"use strict\";\n var blah = arguments;\n try {\n eval(\"var arguments = 20;\");\n return false;\n } catch (e) {\n return e instanceof SyntaxError && blah === arguments;\n }\n }).call(this));\n",
|
|
"precondition": "(fnSupportsStrict())",
|
|
"strict_only": ""
|
|
},
|
|
{
|
|
"id": "11.13.1-4-3-s",
|
|
"path": "TestCases/chapter11/11.13/11.13.1/11.13.1-4-3-s.js",
|
|
"description": "simple assignment throws TypeError if LeftHandSide is a readonly property in strict mode (Global.Infinity)",
|
|
"test": "assertTrue((function testcase() {\n 'use strict';\n\n try {\n fnGlobalObject().Infinity = 42;\n return false;\n }\n catch (e) {\n return (e instanceof TypeError);\n }\n }).call(this));\n",
|
|
"precondition": "(fnSupportsStrict())",
|
|
"strict_only": ""
|
|
},
|
|
{
|
|
"id": "11.13.1-4-6-s",
|
|
"path": "TestCases/chapter11/11.13/11.13.1/11.13.1-4-6-s.js",
|
|
"description": "simple assignment throws TypeError if LeftHandSide is a readonly property in strict mode (Function.length)",
|
|
"test": "assertTrue((function testcase() {\n 'use strict';\n \n try {\n Function.length = 42;\n return false;\n }\n catch (e) {\n return (e instanceof TypeError);\n }\n }).call(this));\n",
|
|
"precondition": "(fnSupportsStrict())",
|
|
"strict_only": ""
|
|
}
|
|
]
|
|
}
|
|
}
|