From a7deb7bcceb33d4604f51ad18636a6b5dee75f60 Mon Sep 17 00:00:00 2001 From: Mike Pennisi Date: Sun, 28 Oct 2018 16:07:20 -0400 Subject: [PATCH] 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; +}