test262/website/resources/scripts/testcases2/12.10.1.json

127 lines
9.1 KiB
JSON

{
"testCollection": {
"name": "12.10.1",
"numTests": 15,
"tests": [
{
"id": "12.10.1-1-s",
"path": "TestCases/chapter12/12.10/12.10.1/12.10.1-1-s.js",
"description": "with statement in strict mode throws SyntaxError (strict function)",
"test": "assertTrue((function testcase() {\n\n try {\n // wrapping it in eval since this needs to be a syntax error. The\n // exception thrown must be a SyntaxError exception.\n eval(\"\\\n function f() {\\\n \\'use strict\\';\\\n var o = {}; \\\n with (o) {};\\\n }\\\n \");\n return false;\n }\n catch (e) {\n return(e instanceof SyntaxError); \n\t}\n }).call(this));\n",
"precondition": "(fnSupportsStrict())",
"strict_only": ""
},
{
"id": "12.10.1-10-s",
"path": "TestCases/chapter12/12.10/12.10.1/12.10.1-10-s.js",
"description": "with statement in strict mode throws SyntaxError (eval, where the container function is strict)",
"test": "assertTrue((function testcase() {\n 'use strict';\n \n // wrapping it in eval since this needs to be a syntax error. The\n // exception thrown must be a SyntaxError exception. Note that eval\n // inherits the strictness of its calling context. \n try {\n eval(\"\\\n var o = {};\\\n with (o) {}\\\n \");\n return false;\n }\n catch (e) {\n return (e instanceof SyntaxError);\n }\n }).call(this));\n",
"precondition": "(fnSupportsStrict())",
"strict_only": ""
},
{
"id": "12.10.1-11-s",
"path": "TestCases/chapter12/12.10/12.10.1/12.10.1-11-s.js",
"description": "Strict Mode - SyntaxError is thrown when using WithStatement in strict mode code",
"test": "assertTrue((function testcase() {\n \"use strict\";\n try {\n eval(\"with ({}) { throw new Error();}\");\n\n return false;\n } catch (e) {\n return e instanceof SyntaxError;\n }\n }).call(this));\n",
"precondition": "(fnSupportsStrict())",
"strict_only": ""
},
{
"id": "12.10.1-12-s",
"path": "TestCases/chapter12/12.10/12.10.1/12.10.1-12-s.js",
"description": "with statement in strict mode throws SyntaxError (strict eval)",
"test": "assertTrue((function testcase() {\n try {\n eval(\"\\\n 'use strict'; \\\n var o = {}; \\\n with (o) {}\\\n \");\n return false;\n }\n catch (e) {\n return (e instanceof SyntaxError) ;\n }\n }).call(this));\n",
"precondition": "(fnSupportsStrict())",
"strict_only": ""
},
{
"id": "12.10.1-13-s",
"path": "TestCases/chapter12/12.10/12.10.1/12.10.1-13-s.js",
"description": "Strict Mode - SyntaxError isn't thrown when WithStatement body is in strict mode code",
"test": "assertTrue((function testcase() {\n with ({}) {\n \"use strict\";\n }\n return true;\n }).call(this));\n",
"strict_only": ""
},
{
"id": "12.10.1-14-s",
"path": "TestCases/chapter12/12.10/12.10.1/12.10.1-14-s.js",
"description": "Strict Mode - SyntaxError is thrown when the getter of a literal object utilizes WithStatement",
"test": "assertTrue((function testcase() {\n \"use strict\";\n\n try {\n eval(\"var obj = { get: function (a) { with(a){} } }; \");\n\n return false;\n } catch (e) {\n return e instanceof SyntaxError;\n }\n }).call(this));\n",
"precondition": "(fnSupportsStrict())",
"strict_only": ""
},
{
"id": "12.10.1-15-s",
"path": "TestCases/chapter12/12.10/12.10.1/12.10.1-15-s.js",
"description": "Strict Mode - SyntaxError is thrown when the RHS of a dot property assignment utilizes WithStatement",
"test": "assertTrue((function testcase() {\n \"use strict\";\n\n try {\n eval(\"var obj = {}; obj.get = function (a) { with(a){} }; \");\n return false;\n } catch (e) {\n return e instanceof SyntaxError;\n }\n }).call(this));\n",
"precondition": "(fnSupportsStrict())",
"strict_only": ""
},
{
"id": "12.10.1-16-s",
"path": "TestCases/chapter12/12.10/12.10.1/12.10.1-16-s.js",
"description": "Strict Mode - SyntaxError is thrown when the RHS of an object indexer assignment utilizes WithStatement",
"test": "assertTrue((function testcase() {\n \"use strict\";\n\n try {\n eval(\"var obj = {}; obj['get'] = function (a) { with(a){} }; \");\n return false;\n } catch (e) {\n return e instanceof SyntaxError;\n }\n }).call(this));\n",
"precondition": "(fnSupportsStrict())",
"strict_only": ""
},
{
"id": "12.10.1-2-s",
"path": "TestCases/chapter12/12.10/12.10.1/12.10.1-2-s.js",
"description": "with statement in strict mode throws SyntaxError (nested function where container is strict)",
"test": "assertTrue((function testcase() {\n try {\n // wrapping it in eval since this needs to be a syntax error. The\n // exception thrown must be a SyntaxError exception.\n eval(\"\\\n function foo() {\\\n \\'use strict\\'; \\\n function f() {\\\n var o = {}; \\\n with (o) {};\\\n }\\\n }\\\n \");\n return false;\n }\n catch (e) {\n return (e instanceof SyntaxError);\n }\n }).call(this));\n",
"precondition": "(fnSupportsStrict())",
"strict_only": ""
},
{
"id": "12.10.1-3-s",
"path": "TestCases/chapter12/12.10/12.10.1/12.10.1-3-s.js",
"description": "with statement in strict mode throws SyntaxError (nested strict function)",
"test": "assertTrue((function testcase() {\n try {\n // wrapping it in eval since this needs to be a syntax error. The\n // exception thrown must be a SyntaxError exception.\n eval(\"\\\n function foo() {\\\n function f() {\\\n \\'use strict\\'; \\\n var o = {}; \\\n with (o) {};\\\n }\\\n }\\\n \");\n return false;\n }\n catch (e) {\n return (e instanceof SyntaxError);\n }\n }).call(this));\n",
"precondition": "(fnSupportsStrict())",
"strict_only": ""
},
{
"id": "12.10.1-4-s",
"path": "TestCases/chapter12/12.10/12.10.1/12.10.1-4-s.js",
"description": "with statement in strict mode throws SyntaxError (strict Function)",
"test": "assertTrue((function testcase() {\n try {\n var f = Function(\"\\\n \\'use strict\\'; \\\n var o = {}; \\\n with (o) {};\\\n \");\n return false;\n }\n catch (e) {\n return (e instanceof SyntaxError);\n\t\n }\n }).call(this));\n",
"precondition": "(fnSupportsStrict())",
"strict_only": ""
},
{
"id": "12.10.1-5-s",
"path": "TestCases/chapter12/12.10/12.10.1/12.10.1-5-s.js",
"description": "with statement allowed in nested Function even if its container Function is strict)",
"test": "assertTrue((function testcase() {\n \n Function(\"\\'use strict\\'; var f1 = Function( \\\"var o = {}; with (o) {};\\\")\");\n return true;\n \n }).call(this));\n",
"strict_only": ""
},
{
"id": "12.10.1-7-s",
"path": "TestCases/chapter12/12.10/12.10.1/12.10.1-7-s.js",
"description": "with statement in strict mode throws SyntaxError (function expression, where the container function is directly evaled from strict code)",
"test": "assertTrue((function testcase() {\n 'use strict';\n\n try {\n eval(\"var f = function () {\\\n var o = {}; \\\n with (o) {}; \\\n }\\\n \");\n return false;\n }\n catch (e) {\n return (e instanceof SyntaxError);\n }\n }).call(this));\n",
"precondition": "(fnSupportsStrict())",
"strict_only": ""
},
{
"id": "12.10.1-8-s",
"path": "TestCases/chapter12/12.10/12.10.1/12.10.1-8-s.js",
"description": "with statement in strict mode throws SyntaxError (function expression, where the container Function is strict)",
"test": "assertTrue((function testcase() {\n try {\n Function(\"\\\n \\'use strict\\'; \\\n var f1 = function () {\\\n var o = {}; \\\n with (o) {}; \\\n }\\\n \");\n return false;\n }\n catch (e) {\n return (e instanceof SyntaxError);\n }\n }).call(this));\n",
"precondition": "(fnSupportsStrict())",
"strict_only": ""
},
{
"id": "12.10.1-9-s",
"path": "TestCases/chapter12/12.10/12.10.1/12.10.1-9-s.js",
"description": "with statement in strict mode throws SyntaxError (strict function expression)",
"test": "assertTrue((function testcase() {\n try {\n eval(\"\\\n var f = function () {\\\n \\'use strict\\';\\\n var o = {}; \\\n with (o) {}; \\\n }\\\n \");\n return false;\n }\n catch (e) {\n return (e instanceof SyntaxError) ;\n }\n }).call(this));\n",
"precondition": "(fnSupportsStrict())",
"strict_only": ""
}
]
}
}