From 835c202b366284fd1c1072aa30419b96e69b4096 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Sun, 23 Sep 2018 20:48:25 -0400 Subject: [PATCH 1/6] Remove redundant and irrelevant tests Two tests placed within the "variable" directory do not include a variable declaration. Because the behavior they assert is covered by an existing test (test/language/arguments-object/10.5-1gs.js), they may be removed without reducing coverage. --- test/language/statements/variable/12.2.1-13-s.js | 13 ------------- test/language/statements/variable/12.2.1-15-s.js | 15 --------------- 2 files changed, 28 deletions(-) delete mode 100644 test/language/statements/variable/12.2.1-13-s.js delete mode 100644 test/language/statements/variable/12.2.1-15-s.js diff --git a/test/language/statements/variable/12.2.1-13-s.js b/test/language/statements/variable/12.2.1-13-s.js deleted file mode 100644 index 5e9fc3a6d5..0000000000 --- a/test/language/statements/variable/12.2.1-13-s.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 12.2.1-13-s -description: arguments assignment throws SyntaxError in strict mode -flags: [onlyStrict] ----*/ - - -assert.throws(SyntaxError, function() { - eval('function foo() { arguments = 42; }; foo()'); -}); diff --git a/test/language/statements/variable/12.2.1-15-s.js b/test/language/statements/variable/12.2.1-15-s.js deleted file mode 100644 index 8447267316..0000000000 --- a/test/language/statements/variable/12.2.1-15-s.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 12.2.1-15-s -description: > - arguments - a function expr assigning into 'arguments' throws a - SyntaxError in strict mode -flags: [onlyStrict] ----*/ - - -assert.throws(SyntaxError, function() { - eval('(function () {arguments = 42;})()'); -}); From ceb79988ae7c6b0b2c52a141af4063655e2e002a Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Sun, 23 Sep 2018 21:32:15 -0400 Subject: [PATCH 2/6] Relocate and refactor tests The tests for the parsing of `for/in` loops were expressed using eval. This made the tests more complex than necessary and also prevented the tests from providing value to ECMAScript parsers. Remove the use of eval and instead express the expectations with literal source text. Move the tests to the `for-in` directory to better reflect the grammar production that they test. --- .../var-arguments-strict-init.js} | 10 ++++++---- .../12.2.1-36-s.js => for-in/var-arguments-strict.js} | 10 ++++++---- .../12.2.1-35-s.js => for-in/var-eval-strict-init.js} | 10 ++++++---- .../12.2.1-34-s.js => for-in/var-eval-strict.js} | 10 ++++++---- 4 files changed, 24 insertions(+), 16 deletions(-) rename test/language/statements/{variable/12.2.1-37-s.js => for-in/var-arguments-strict-init.js} (62%) rename test/language/statements/{variable/12.2.1-36-s.js => for-in/var-arguments-strict.js} (61%) rename test/language/statements/{variable/12.2.1-35-s.js => for-in/var-eval-strict-init.js} (61%) rename test/language/statements/{variable/12.2.1-34-s.js => for-in/var-eval-strict.js} (61%) diff --git a/test/language/statements/variable/12.2.1-37-s.js b/test/language/statements/for-in/var-arguments-strict-init.js similarity index 62% rename from test/language/statements/variable/12.2.1-37-s.js rename to test/language/statements/for-in/var-arguments-strict-init.js index cf7227e630..b46aed9d31 100644 --- a/test/language/statements/variable/12.2.1-37-s.js +++ b/test/language/statements/for-in/var-arguments-strict-init.js @@ -2,14 +2,16 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es5id: 12.2.1-37-s +esid: sec-for-statement description: > 'for(var arguments = 42 in ...) {...}' throws SyntaxError in strict mode flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('for (var arguments = 42 in null) {};'); -}); +for (var arguments = 42 in null) {} diff --git a/test/language/statements/variable/12.2.1-36-s.js b/test/language/statements/for-in/var-arguments-strict.js similarity index 61% rename from test/language/statements/variable/12.2.1-36-s.js rename to test/language/statements/for-in/var-arguments-strict.js index 872d7c7c2a..973ecafe5b 100644 --- a/test/language/statements/variable/12.2.1-36-s.js +++ b/test/language/statements/for-in/var-arguments-strict.js @@ -2,12 +2,14 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es5id: 12.2.1-36-s +esid: sec-for-statement description: "'for(var arguments in ...) {...}' throws SyntaxError in strict mode" flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('for (var arguments in null) {};'); -}); +for (var arguments in null) {} diff --git a/test/language/statements/variable/12.2.1-35-s.js b/test/language/statements/for-in/var-eval-strict-init.js similarity index 61% rename from test/language/statements/variable/12.2.1-35-s.js rename to test/language/statements/for-in/var-eval-strict-init.js index 5d8d17ce55..efdba55afd 100644 --- a/test/language/statements/variable/12.2.1-35-s.js +++ b/test/language/statements/for-in/var-eval-strict-init.js @@ -2,12 +2,14 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es5id: 12.2.1-35-s +esid: sec-for-statement description: "'for(var eval = 42 in ...) {...}' throws SyntaxError in strict mode" flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('for (var eval = 42 in null) {};'); -}); +for (var eval = 42 in null) {} diff --git a/test/language/statements/variable/12.2.1-34-s.js b/test/language/statements/for-in/var-eval-strict.js similarity index 61% rename from test/language/statements/variable/12.2.1-34-s.js rename to test/language/statements/for-in/var-eval-strict.js index c7794514a1..114add8d1f 100644 --- a/test/language/statements/variable/12.2.1-34-s.js +++ b/test/language/statements/for-in/var-eval-strict.js @@ -2,12 +2,14 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es5id: 12.2.1-34-s +esid: sec-for-statement description: "'for(var eval in ...) {...}' throws SyntaxError in strict mode" flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('for (var eval in null) {};'); -}); +for (var eval in null) {} From 6b00c8fbfefa4207d39901e480bae402701ee6b4 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Sun, 23 Sep 2018 21:32:37 -0400 Subject: [PATCH 3/6] Rename and refactor tests The tests for the parsing of variable declarations were expressed using eval. This made the tests more complex than necessary and also prevented the tests from providing value to ECMAScript parsers. Remove the use of eval and instead express the expectations with literal source text. --- .../variable/{12.2.1-12.js => arguments-non-strict.js} | 3 ++- ...2.2.1-28-s.js => arguments-strict-list-final-init.js} | 9 ++++++--- .../{12.2.1-30-s.js => arguments-strict-list-final.js} | 9 ++++++--- .../{12.2.1-25-s.js => arguments-strict-list-first.js} | 9 ++++++--- .../{12.2.1-33-s.js => arguments-strict-list-middle.js} | 9 ++++++--- ...{12.2.1-32-s.js => arguments-strict-list-repeated.js} | 9 ++++++--- .../{12.2.1-23-s.js => arguments-strict-single-init.js} | 9 ++++++--- .../{12.2.1-12-s.js => arguments-strict-single.js} | 9 ++++++--- .../{12.2.1-26-s.js => eval-strict-list-final.js} | 9 ++++++--- .../{12.2.1-27-s.js => eval-strict-list-first-init.js} | 9 ++++++--- .../{12.2.1-29-s.js => eval-strict-list-first.js} | 9 ++++++--- .../{12.2.1-31-s.js => eval-strict-list-repeated.js} | 9 ++++++--- .../{12.2.1-24-s.js => eval-strict-single-init.js} | 9 ++++++--- .../variable/{12.2.1-1-s.js => eval-strict-single.js} | 9 ++++++--- 14 files changed, 80 insertions(+), 40 deletions(-) rename test/language/statements/variable/{12.2.1-12.js => arguments-non-strict.js} (84%) rename test/language/statements/variable/{12.2.1-28-s.js => arguments-strict-list-final-init.js} (65%) rename test/language/statements/variable/{12.2.1-30-s.js => arguments-strict-list-final.js} (63%) rename test/language/statements/variable/{12.2.1-25-s.js => arguments-strict-list-first.js} (64%) rename test/language/statements/variable/{12.2.1-33-s.js => arguments-strict-list-middle.js} (63%) rename test/language/statements/variable/{12.2.1-32-s.js => arguments-strict-list-repeated.js} (65%) rename test/language/statements/variable/{12.2.1-23-s.js => arguments-strict-single-init.js} (65%) rename test/language/statements/variable/{12.2.1-12-s.js => arguments-strict-single.js} (64%) rename test/language/statements/variable/{12.2.1-26-s.js => eval-strict-list-final.js} (64%) rename test/language/statements/variable/{12.2.1-27-s.js => eval-strict-list-first-init.js} (65%) rename test/language/statements/variable/{12.2.1-29-s.js => eval-strict-list-first.js} (63%) rename test/language/statements/variable/{12.2.1-31-s.js => eval-strict-list-repeated.js} (66%) rename test/language/statements/variable/{12.2.1-24-s.js => eval-strict-single-init.js} (66%) rename test/language/statements/variable/{12.2.1-1-s.js => eval-strict-single.js} (67%) diff --git a/test/language/statements/variable/12.2.1-12.js b/test/language/statements/variable/arguments-non-strict.js similarity index 84% rename from test/language/statements/variable/12.2.1-12.js rename to test/language/statements/variable/arguments-non-strict.js index 130ecf0eb6..9ffb6f6dee 100644 --- a/test/language/statements/variable/12.2.1-12.js +++ b/test/language/statements/variable/arguments-non-strict.js @@ -3,8 +3,9 @@ /*--- es5id: 12.2.1-12 +esid: sec-variable-statement description: arguments as local var identifier is allowed flags: [noStrict] ---*/ - eval("(function (){var arguments;})"); +var arguments; diff --git a/test/language/statements/variable/12.2.1-28-s.js b/test/language/statements/variable/arguments-strict-list-final-init.js similarity index 65% rename from test/language/statements/variable/12.2.1-28-s.js rename to test/language/statements/variable/arguments-strict-list-final-init.js index c06f66b58c..afc16f42a7 100644 --- a/test/language/statements/variable/12.2.1-28-s.js +++ b/test/language/statements/variable/arguments-strict-list-final-init.js @@ -3,13 +3,16 @@ /*--- es5id: 12.2.1-28-s +esid: sec-variable-statement description: > arguments as local var identifier assigned to throws SyntaxError in strict mode flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('function foo() { var a, arguments = 42;}'); -}); +var a, arguments = 42; diff --git a/test/language/statements/variable/12.2.1-30-s.js b/test/language/statements/variable/arguments-strict-list-final.js similarity index 63% rename from test/language/statements/variable/12.2.1-30-s.js rename to test/language/statements/variable/arguments-strict-list-final.js index 2fb229dda0..2c513d0754 100644 --- a/test/language/statements/variable/12.2.1-30-s.js +++ b/test/language/statements/variable/arguments-strict-list-final.js @@ -3,11 +3,14 @@ /*--- es5id: 12.2.1-30-s +esid: sec-variable-statement description: arguments as local var identifier throws SyntaxError in strict mode flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('function foo() { var a = 42, arguments;}'); -}); +var a = 42, arguments; diff --git a/test/language/statements/variable/12.2.1-25-s.js b/test/language/statements/variable/arguments-strict-list-first.js similarity index 64% rename from test/language/statements/variable/12.2.1-25-s.js rename to test/language/statements/variable/arguments-strict-list-first.js index 95712e37f4..98023fea67 100644 --- a/test/language/statements/variable/12.2.1-25-s.js +++ b/test/language/statements/variable/arguments-strict-list-first.js @@ -3,11 +3,14 @@ /*--- es5id: 12.2.1-25-s +esid: sec-variable-statement description: arguments as local var identifier throws SyntaxError in strict mode flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('function foo() { var arguments, a;}'); -}); +var arguments, a; diff --git a/test/language/statements/variable/12.2.1-33-s.js b/test/language/statements/variable/arguments-strict-list-middle.js similarity index 63% rename from test/language/statements/variable/12.2.1-33-s.js rename to test/language/statements/variable/arguments-strict-list-middle.js index 0b474dd519..15dbe4c09b 100644 --- a/test/language/statements/variable/12.2.1-33-s.js +++ b/test/language/statements/variable/arguments-strict-list-middle.js @@ -3,11 +3,14 @@ /*--- es5id: 12.2.1-33-s +esid: sec-variable-statement description: arguments as local var identifier throws SyntaxError in strict mode flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('function foo() { var a, arguments, b;}'); -}); +var a, arguments, b; diff --git a/test/language/statements/variable/12.2.1-32-s.js b/test/language/statements/variable/arguments-strict-list-repeated.js similarity index 65% rename from test/language/statements/variable/12.2.1-32-s.js rename to test/language/statements/variable/arguments-strict-list-repeated.js index 12326d08bf..20756b56d9 100644 --- a/test/language/statements/variable/12.2.1-32-s.js +++ b/test/language/statements/variable/arguments-strict-list-repeated.js @@ -3,13 +3,16 @@ /*--- es5id: 12.2.1-32-s +esid: sec-variable-statement description: > arguments as local var identifier defined twice and assigned once throws SyntaxError in strict mode flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('function foo() { var arguments, arguments = 42;}'); -}); +var arguments, arguments = 42; diff --git a/test/language/statements/variable/12.2.1-23-s.js b/test/language/statements/variable/arguments-strict-single-init.js similarity index 65% rename from test/language/statements/variable/12.2.1-23-s.js rename to test/language/statements/variable/arguments-strict-single-init.js index 45e3912de7..d9492f2da2 100644 --- a/test/language/statements/variable/12.2.1-23-s.js +++ b/test/language/statements/variable/arguments-strict-single-init.js @@ -3,13 +3,16 @@ /*--- es5id: 12.2.1-23-s +esid: sec-variable-statement description: > arguments as local var identifier assigned to throws SyntaxError in strict mode flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('function foo() { var arguments = 42;}'); -}); +var arguments = 42; diff --git a/test/language/statements/variable/12.2.1-12-s.js b/test/language/statements/variable/arguments-strict-single.js similarity index 64% rename from test/language/statements/variable/12.2.1-12-s.js rename to test/language/statements/variable/arguments-strict-single.js index 50ffbfef3c..a5ce7627da 100644 --- a/test/language/statements/variable/12.2.1-12-s.js +++ b/test/language/statements/variable/arguments-strict-single.js @@ -3,11 +3,14 @@ /*--- es5id: 12.2.1-12-s +esid: sec-variable-statement description: arguments as local var identifier throws SyntaxError in strict mode flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('function foo() { var arguments;}'); -}); +var arguments; diff --git a/test/language/statements/variable/12.2.1-26-s.js b/test/language/statements/variable/eval-strict-list-final.js similarity index 64% rename from test/language/statements/variable/12.2.1-26-s.js rename to test/language/statements/variable/eval-strict-list-final.js index 427689845b..429ce2cf19 100644 --- a/test/language/statements/variable/12.2.1-26-s.js +++ b/test/language/statements/variable/eval-strict-list-final.js @@ -3,11 +3,14 @@ /*--- es5id: 12.2.1-26-s +esid: sec-variable-statement description: eval as local var identifier throws SyntaxError in strict mode flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('function foo() { var a, eval;}'); -}); +var a, eval; diff --git a/test/language/statements/variable/12.2.1-27-s.js b/test/language/statements/variable/eval-strict-list-first-init.js similarity index 65% rename from test/language/statements/variable/12.2.1-27-s.js rename to test/language/statements/variable/eval-strict-list-first-init.js index 51b3bc1b32..17f3b0810d 100644 --- a/test/language/statements/variable/12.2.1-27-s.js +++ b/test/language/statements/variable/eval-strict-list-first-init.js @@ -3,13 +3,16 @@ /*--- es5id: 12.2.1-27-s +esid: sec-variable-statement description: > eval as local var identifier assigned to throws SyntaxError in strict mode flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('function foo() { var eval = 42, a;}'); -}); +var eval = 42, a; diff --git a/test/language/statements/variable/12.2.1-29-s.js b/test/language/statements/variable/eval-strict-list-first.js similarity index 63% rename from test/language/statements/variable/12.2.1-29-s.js rename to test/language/statements/variable/eval-strict-list-first.js index f188ae7196..423be25f7e 100644 --- a/test/language/statements/variable/12.2.1-29-s.js +++ b/test/language/statements/variable/eval-strict-list-first.js @@ -3,11 +3,14 @@ /*--- es5id: 12.2.1-29-s +esid: sec-variable-statement description: eval as local var identifier throws SyntaxError in strict mode flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('function foo() { var eval, a = 42;}'); -}); +var eval, a = 42; diff --git a/test/language/statements/variable/12.2.1-31-s.js b/test/language/statements/variable/eval-strict-list-repeated.js similarity index 66% rename from test/language/statements/variable/12.2.1-31-s.js rename to test/language/statements/variable/eval-strict-list-repeated.js index 937313d894..22c69bd0b8 100644 --- a/test/language/statements/variable/12.2.1-31-s.js +++ b/test/language/statements/variable/eval-strict-list-repeated.js @@ -3,13 +3,16 @@ /*--- es5id: 12.2.1-31-s +esid: sec-variable-statement description: > eval as local var identifier defined twice throws SyntaxError in strict mode flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('function foo() { var eval, eval;}'); -}); +var eval, eval; diff --git a/test/language/statements/variable/12.2.1-24-s.js b/test/language/statements/variable/eval-strict-single-init.js similarity index 66% rename from test/language/statements/variable/12.2.1-24-s.js rename to test/language/statements/variable/eval-strict-single-init.js index 8e5818b107..0294333215 100644 --- a/test/language/statements/variable/12.2.1-24-s.js +++ b/test/language/statements/variable/eval-strict-single-init.js @@ -3,13 +3,16 @@ /*--- es5id: 12.2.1-24-s +esid: sec-variable-statement description: > eval as local var identifier assigned to throws SyntaxError in strict mode flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('function foo() { var eval = 42;}'); -}); +var eval = 42; diff --git a/test/language/statements/variable/12.2.1-1-s.js b/test/language/statements/variable/eval-strict-single.js similarity index 67% rename from test/language/statements/variable/12.2.1-1-s.js rename to test/language/statements/variable/eval-strict-single.js index bdf44cea2b..096efa5e91 100644 --- a/test/language/statements/variable/12.2.1-1-s.js +++ b/test/language/statements/variable/eval-strict-single.js @@ -3,13 +3,16 @@ /*--- es5id: 12.2.1-1-s +esid: sec-variable-statement description: > eval - a function declaring a var named 'eval' throws SyntaxError in strict mode flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError ---*/ +throw "Test262: This statement should not be evaluated."; -assert.throws(SyntaxError, function() { - eval('function foo() { var eval; }'); -}); +var eval; From b819c597abcb2242bf5a46da7e1f9cb4cd889c98 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Sun, 23 Sep 2018 22:15:07 -0400 Subject: [PATCH 4/6] Remove redundant test This behavior is covered by another test in this directory: `arguments-strict-single.js`. Although the syntax error happens to occur within the body of a function expression, this distinction is not significant enough to warrant the test's presence nor does it motivate the introduction of many similar negative syntax tests which are currently unavailable. --- test/language/statements/variable/12.2.1-14-s.js | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 test/language/statements/variable/12.2.1-14-s.js diff --git a/test/language/statements/variable/12.2.1-14-s.js b/test/language/statements/variable/12.2.1-14-s.js deleted file mode 100644 index 06cf5eba8d..0000000000 --- a/test/language/statements/variable/12.2.1-14-s.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2012 Ecma International. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -es5id: 12.2.1-14-s -description: > - arguments - a function expr declaring a var named 'arguments' - throws SyntaxError in strict mode -flags: [onlyStrict] ----*/ - - -assert.throws(SyntaxError, function() { - eval('(function (){var arguments;});'); -}); From aac38cb368fe6562cea2ee540494109b34ca2c7f Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Sun, 23 Sep 2018 22:31:06 -0400 Subject: [PATCH 5/6] Normalize coverage for `var` declarations Add tests to mirror similar tests which were authored previously. --- .../variable/arguments-strict-list-first-init.js | 15 +++++++++++++++ .../variable/arguments-strict-list-middle-init.js | 15 +++++++++++++++ .../statements/variable/eval-non-strict.js | 10 ++++++++++ .../variable/eval-strict-list-final-init.js | 15 +++++++++++++++ .../variable/eval-strict-list-middle-init.js | 15 +++++++++++++++ .../variable/eval-strict-list-middle.js | 15 +++++++++++++++ 6 files changed, 85 insertions(+) create mode 100644 test/language/statements/variable/arguments-strict-list-first-init.js create mode 100644 test/language/statements/variable/arguments-strict-list-middle-init.js create mode 100644 test/language/statements/variable/eval-non-strict.js create mode 100644 test/language/statements/variable/eval-strict-list-final-init.js create mode 100644 test/language/statements/variable/eval-strict-list-middle-init.js create mode 100644 test/language/statements/variable/eval-strict-list-middle.js diff --git a/test/language/statements/variable/arguments-strict-list-first-init.js b/test/language/statements/variable/arguments-strict-list-first-init.js new file mode 100644 index 0000000000..b155a1578c --- /dev/null +++ b/test/language/statements/variable/arguments-strict-list-first-init.js @@ -0,0 +1,15 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-variable-statement +description: arguments as local var identifier throws SyntaxError in strict mode +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +var arguments = 42, a; diff --git a/test/language/statements/variable/arguments-strict-list-middle-init.js b/test/language/statements/variable/arguments-strict-list-middle-init.js new file mode 100644 index 0000000000..23c53836d0 --- /dev/null +++ b/test/language/statements/variable/arguments-strict-list-middle-init.js @@ -0,0 +1,15 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-variable-statement +description: arguments as local var identifier throws SyntaxError in strict mode +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +var a, arguments = 42, b; diff --git a/test/language/statements/variable/eval-non-strict.js b/test/language/statements/variable/eval-non-strict.js new file mode 100644 index 0000000000..f3c942786e --- /dev/null +++ b/test/language/statements/variable/eval-non-strict.js @@ -0,0 +1,10 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-variable-statement +description: arguments as local var identifier is allowed +flags: [noStrict] +---*/ + +var eval; diff --git a/test/language/statements/variable/eval-strict-list-final-init.js b/test/language/statements/variable/eval-strict-list-final-init.js new file mode 100644 index 0000000000..1be4ef8724 --- /dev/null +++ b/test/language/statements/variable/eval-strict-list-final-init.js @@ -0,0 +1,15 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-variable-statement +description: eval as local var identifier throws SyntaxError in strict mode +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +var a, eval = 42; diff --git a/test/language/statements/variable/eval-strict-list-middle-init.js b/test/language/statements/variable/eval-strict-list-middle-init.js new file mode 100644 index 0000000000..78f9d06540 --- /dev/null +++ b/test/language/statements/variable/eval-strict-list-middle-init.js @@ -0,0 +1,15 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-variable-statement +description: arguments as local var identifier throws SyntaxError in strict mode +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +var a, eval = 42, b; diff --git a/test/language/statements/variable/eval-strict-list-middle.js b/test/language/statements/variable/eval-strict-list-middle.js new file mode 100644 index 0000000000..2794f99107 --- /dev/null +++ b/test/language/statements/variable/eval-strict-list-middle.js @@ -0,0 +1,15 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-variable-statement +description: arguments as local var identifier throws SyntaxError in strict mode +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +var a, eval, b; From a7deb7bcceb33d4604f51ad18636a6b5dee75f60 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Sun, 28 Oct 2018 16:07:20 -0400 Subject: [PATCH 6/6] Add tests for `arguments` within function body --- .../for-in/var-arguments-fn-strict-init.js | 19 ++++++++++++++++++ .../for-in/var-arguments-fn-strict.js | 19 ++++++++++++++++++ .../variable/arguments-fn-non-strict.js | 14 +++++++++++++ .../arguments-fn-strict-list-final-init.js | 20 +++++++++++++++++++ .../arguments-fn-strict-list-final.js | 20 +++++++++++++++++++ .../arguments-fn-strict-list-first-init.js | 19 ++++++++++++++++++ .../arguments-fn-strict-list-first.js | 20 +++++++++++++++++++ .../arguments-fn-strict-list-middle-init.js | 19 ++++++++++++++++++ .../arguments-fn-strict-list-middle.js | 20 +++++++++++++++++++ .../arguments-fn-strict-list-repeated.js | 20 +++++++++++++++++++ .../arguments-fn-strict-single-init.js | 20 +++++++++++++++++++ .../variable/arguments-fn-strict-single.js | 20 +++++++++++++++++++ 12 files changed, 230 insertions(+) create mode 100644 test/language/statements/for-in/var-arguments-fn-strict-init.js create mode 100644 test/language/statements/for-in/var-arguments-fn-strict.js create mode 100644 test/language/statements/variable/arguments-fn-non-strict.js create mode 100644 test/language/statements/variable/arguments-fn-strict-list-final-init.js create mode 100644 test/language/statements/variable/arguments-fn-strict-list-final.js create mode 100644 test/language/statements/variable/arguments-fn-strict-list-first-init.js create mode 100644 test/language/statements/variable/arguments-fn-strict-list-first.js create mode 100644 test/language/statements/variable/arguments-fn-strict-list-middle-init.js create mode 100644 test/language/statements/variable/arguments-fn-strict-list-middle.js create mode 100644 test/language/statements/variable/arguments-fn-strict-list-repeated.js create mode 100644 test/language/statements/variable/arguments-fn-strict-single-init.js create mode 100644 test/language/statements/variable/arguments-fn-strict-single.js diff --git a/test/language/statements/for-in/var-arguments-fn-strict-init.js b/test/language/statements/for-in/var-arguments-fn-strict-init.js new file mode 100644 index 0000000000..9c76686b07 --- /dev/null +++ b/test/language/statements/for-in/var-arguments-fn-strict-init.js @@ -0,0 +1,19 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-for-statement +description: > + 'for(var arguments = 42 in ...) {...}' throws SyntaxError in + strict mode within a function declaration +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +function f() { + for (var arguments = 42 in null) {} +} diff --git a/test/language/statements/for-in/var-arguments-fn-strict.js b/test/language/statements/for-in/var-arguments-fn-strict.js new file mode 100644 index 0000000000..c2ae108ebf --- /dev/null +++ b/test/language/statements/for-in/var-arguments-fn-strict.js @@ -0,0 +1,19 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-for-statement +description: > + 'for(var arguments in ...) {...}' throws SyntaxError in strict mode within a + function declaration +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +function f() { + for (var arguments in null) {} +} diff --git a/test/language/statements/variable/arguments-fn-non-strict.js b/test/language/statements/variable/arguments-fn-non-strict.js new file mode 100644 index 0000000000..0683272952 --- /dev/null +++ b/test/language/statements/variable/arguments-fn-non-strict.js @@ -0,0 +1,14 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.2.1-12 +esid: sec-variable-statement +description: > + arguments as local var identifier is allowed within a function declaration +flags: [noStrict] +---*/ + +function f() { + var arguments; +} diff --git a/test/language/statements/variable/arguments-fn-strict-list-final-init.js b/test/language/statements/variable/arguments-fn-strict-list-final-init.js new file mode 100644 index 0000000000..21253504e6 --- /dev/null +++ b/test/language/statements/variable/arguments-fn-strict-list-final-init.js @@ -0,0 +1,20 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.2.1-28-s +esid: sec-variable-statement +description: > + arguments as local var identifier assigned to throws SyntaxError + in strict mode within a function declaration +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +function f() { + var a, arguments = 42; +} diff --git a/test/language/statements/variable/arguments-fn-strict-list-final.js b/test/language/statements/variable/arguments-fn-strict-list-final.js new file mode 100644 index 0000000000..824c882221 --- /dev/null +++ b/test/language/statements/variable/arguments-fn-strict-list-final.js @@ -0,0 +1,20 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.2.1-30-s +esid: sec-variable-statement +description: > + arguments as local var identifier throws SyntaxError in strict mode within a + function declaration +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +function f() { + var a = 42, arguments; +} diff --git a/test/language/statements/variable/arguments-fn-strict-list-first-init.js b/test/language/statements/variable/arguments-fn-strict-list-first-init.js new file mode 100644 index 0000000000..8e6e022b66 --- /dev/null +++ b/test/language/statements/variable/arguments-fn-strict-list-first-init.js @@ -0,0 +1,19 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-variable-statement +description: > + arguments as local var identifier throws SyntaxError in strict mode within a + function declaration +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +function f() { + var arguments = 42, a; +} diff --git a/test/language/statements/variable/arguments-fn-strict-list-first.js b/test/language/statements/variable/arguments-fn-strict-list-first.js new file mode 100644 index 0000000000..7b7d78e73d --- /dev/null +++ b/test/language/statements/variable/arguments-fn-strict-list-first.js @@ -0,0 +1,20 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.2.1-25-s +esid: sec-variable-statement +description: > + arguments as local var identifier throws SyntaxError in strict mode within a + function declaration +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +function f() { + var arguments, a; +} diff --git a/test/language/statements/variable/arguments-fn-strict-list-middle-init.js b/test/language/statements/variable/arguments-fn-strict-list-middle-init.js new file mode 100644 index 0000000000..9001c3d4fc --- /dev/null +++ b/test/language/statements/variable/arguments-fn-strict-list-middle-init.js @@ -0,0 +1,19 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-variable-statement +description: > + arguments as local var identifier throws SyntaxError in strict mode within a + function declaration +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +function f() { + var a, arguments = 42, b; +} diff --git a/test/language/statements/variable/arguments-fn-strict-list-middle.js b/test/language/statements/variable/arguments-fn-strict-list-middle.js new file mode 100644 index 0000000000..181f0c060c --- /dev/null +++ b/test/language/statements/variable/arguments-fn-strict-list-middle.js @@ -0,0 +1,20 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.2.1-33-s +esid: sec-variable-statement +description: > + arguments as local var identifier throws SyntaxError in strict mode within a + function declaration +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +function f() { + var a, arguments, b; +} diff --git a/test/language/statements/variable/arguments-fn-strict-list-repeated.js b/test/language/statements/variable/arguments-fn-strict-list-repeated.js new file mode 100644 index 0000000000..7ca2ba5bda --- /dev/null +++ b/test/language/statements/variable/arguments-fn-strict-list-repeated.js @@ -0,0 +1,20 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.2.1-32-s +esid: sec-variable-statement +description: > + arguments as local var identifier defined twice and assigned once + throws SyntaxError in strict mode within a function declaration +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +function f() { + var arguments, arguments = 42; +} diff --git a/test/language/statements/variable/arguments-fn-strict-single-init.js b/test/language/statements/variable/arguments-fn-strict-single-init.js new file mode 100644 index 0000000000..50919cd3b4 --- /dev/null +++ b/test/language/statements/variable/arguments-fn-strict-single-init.js @@ -0,0 +1,20 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.2.1-23-s +esid: sec-variable-statement +description: > + arguments as local var identifier assigned to throws SyntaxError + in strict mode within a function declaration +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +function f() { + var arguments = 42; +} diff --git a/test/language/statements/variable/arguments-fn-strict-single.js b/test/language/statements/variable/arguments-fn-strict-single.js new file mode 100644 index 0000000000..bbe8dbb414 --- /dev/null +++ b/test/language/statements/variable/arguments-fn-strict-single.js @@ -0,0 +1,20 @@ +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 12.2.1-12-s +esid: sec-variable-statement +description: > + arguments as local var identifier throws SyntaxError in strict mode within a + function declaration +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +throw "Test262: This statement should not be evaluated."; + +function f() { + var arguments; +}