From aac38cb368fe6562cea2ee540494109b34ca2c7f Mon Sep 17 00:00:00 2001 From: Mike Pennisi <mike@mikepennisi.com> Date: Sun, 23 Sep 2018 22:31:06 -0400 Subject: [PATCH] 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; -- GitLab