diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/language/statements/let/syntax | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/statements/let/syntax')
33 files changed, 559 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/let/syntax/browser.js b/js/src/tests/test262/language/statements/let/syntax/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/browser.js diff --git a/js/src/tests/test262/language/statements/let/syntax/escaped-let.js b/js/src/tests/test262/language/statements/let/syntax/escaped-let.js new file mode 100644 index 0000000000..04c60ff840 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/escaped-let.js @@ -0,0 +1,29 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-grammar-notation +description: > + The `let` contextual keyword must not contain Unicode escape sequences. +info: | + Terminal symbols are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +flags: [noStrict] +---*/ + +// Add a global property "let", so we won't get a runtime reference error below. +this.let = 0; + +l\u0065t // ASI +a; + +// If the parser treated the previous escaped "let" as a lexical declaration, +// this variable declaration will result an early syntax error. +var a; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/let/syntax/identifier-let-allowed-as-lefthandside-expression-strict-strict.js b/js/src/tests/test262/language/statements/let/syntax/identifier-let-allowed-as-lefthandside-expression-strict-strict.js new file mode 100644 index 0000000000..3d8af4f80e --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/identifier-let-allowed-as-lefthandside-expression-strict-strict.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.6.0.1 +description: > + for declaration: + identifier "let" disallowed as lefthandside expression in strict mode +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var o = { a: 1 }; +for (let in o) { } + diff --git a/js/src/tests/test262/language/statements/let/syntax/identifier-let-disallowed-as-boundname.js b/js/src/tests/test262/language/statements/let/syntax/identifier-let-disallowed-as-boundname.js new file mode 100644 index 0000000000..f93207d844 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/identifier-let-disallowed-as-boundname.js @@ -0,0 +1,15 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.6.4.1 +description: > + It is a Syntax Error if the BoundNames of ForDeclaration contains "let". +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +for (let let in {}) { } + diff --git a/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-condition.js b/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-condition.js new file mode 100644 index 0000000000..e0d20e129e --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-condition.js @@ -0,0 +1,14 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let: closure inside for loop condition +---*/ +let a = []; +for (let i = 0; a.push(function () { return i; }), i < 5; ++i) { } +for (let k = 0; k < 5; ++k) { + assert.sameValue(k, a[k]()); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-initialization.js b/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-initialization.js new file mode 100644 index 0000000000..29322ec1e1 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-initialization.js @@ -0,0 +1,16 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let: closure inside for loop initialization +---*/ +let a = []; +for (let i = 0, f = function() { return i }; i < 5; ++i) { + a.push(f); +} +for (let k = 0; k < 5; ++k) { + assert.sameValue(0, a[k]()); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-next-expression.js b/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-next-expression.js new file mode 100644 index 0000000000..e2d7a08ead --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/let-closure-inside-next-expression.js @@ -0,0 +1,14 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let: closure inside for loop next-expression +---*/ +let a = []; +for (let i = 0; i < 5; a.push(function () { return i; }), ++i) { } +for (let k = 0; k < 5; ++k) { + assert.sameValue(k + 1, a[k]()); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding.js b/js/src/tests/test262/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding.js new file mode 100644 index 0000000000..99b7421991 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding.js @@ -0,0 +1,18 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + In a normal for statement the iteration variable is freshly allocated for each iteration. Multi let binding +---*/ +let a = [], b = []; +for (let i = 0, j = 10; i < 5; ++i, ++j) { + a.push(function () { return i; }); + b.push(function () { return j; }); +} +for (let k = 0; k < 5; ++k) { + assert.sameValue(k, a[k]()); + assert.sameValue(k + 10, b[k]()); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding.js b/js/src/tests/test262/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding.js new file mode 100644 index 0000000000..33cc84c50a --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding.js @@ -0,0 +1,16 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + In a normal for statement the iteration variable is freshly allocated for each iteration. Single let binding +---*/ +let a = []; +for (let i = 0; i < 5; ++i) { + a.push(function () { return i; }); +} +for (let j = 0; j < 5; ++j) { + assert.sameValue(j, a[j]()); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/let/syntax/let-let-declaration-split-across-two-lines.js b/js/src/tests/test262/language/statements/let/syntax/let-let-declaration-split-across-two-lines.js new file mode 100644 index 0000000000..ffc309bf53 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/let-let-declaration-split-across-two-lines.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Jeff Walden +es6id: 13.3.1.1 +description: > + let: |let let| split across two lines is not subject to automatic semicolon insertion. +info: | + |let| followed by a name is a lexical declaration. This is so even if the + name is on a new line. ASI applies *only* if an offending token not allowed + by the grammar is encountered, and there's no [no LineTerminator here] + restriction in LexicalDeclaration or ForDeclaration forbidding a line break. + + It's a tricky point, but this is true *even if* the name is "let", a name that + can't be bound by LexicalDeclaration or ForDeclaration. Per 5.3, static + semantics early errors are validated *after* determining productions matching + the source text. + + So in this testcase, the eval text matches LexicalDeclaration. No ASI occurs, + because "let\nlet = ..." matches LexicalDeclaration before static semantics + are considered. *Then* 13.3.1.1's static semantics for the LexicalDeclaration + just chosen, per 5.3, are validated to recognize the Script as invalid. Thus + the eval script can't be evaluated, and a SyntaxError is thrown. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +let // start of a LexicalDeclaration, *not* an ASI opportunity +let; diff --git a/js/src/tests/test262/language/statements/let/syntax/let-let-declaration-with-initializer-split-across-two-lines.js b/js/src/tests/test262/language/statements/let/syntax/let-let-declaration-with-initializer-split-across-two-lines.js new file mode 100644 index 0000000000..28d5758eb9 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/let-let-declaration-with-initializer-split-across-two-lines.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Jeff Walden +es6id: 13.3.1.1 +description: > + let: |let let| split across two lines is not subject to automatic semicolon insertion. +info: | + |let| followed by a name is a lexical declaration. This is so even if the + name is on a new line. ASI applies *only* if an offending token not allowed + by the grammar is encountered, and there's no [no LineTerminator here] + restriction in LexicalDeclaration or ForDeclaration forbidding a line break. + + It's a tricky point, but this is true *even if* the name is "let", a name that + can't be bound by LexicalDeclaration or ForDeclaration. Per 5.3, static + semantics early errors are validated *after* determining productions matching + the source text. + + So in this testcase, the eval text matches LexicalDeclaration. No ASI occurs, + because "let\nlet = ..." matches LexicalDeclaration before static semantics + are considered. *Then* 13.3.1.1's static semantics for the LexicalDeclaration + just chosen, per 5.3, are validated to recognize the Script as invalid. Thus + the eval script can't be evaluated, and a SyntaxError is thrown. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +let // start of a LexicalDeclaration, *not* an ASI opportunity +let = "irrelevant initializer"; diff --git a/js/src/tests/test262/language/statements/let/syntax/let-newline-await-in-normal-function.js b/js/src/tests/test262/language/statements/let/syntax/let-newline-await-in-normal-function.js new file mode 100644 index 0000000000..aa3735d09a --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/let-newline-await-in-normal-function.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Jeff Walden <jwalden+code@mit.edu> +esid: sec-let-and-const-declarations +description: > + `let await` does not permit ASI in between, as `await` is a BindingIdentifier +info: | + `await` is a perfectly cromulent binding name in any context grammatically, just + prohibited by static semantics in some contexts. Therefore ASI can never apply + between `let` (where a LexicalDeclaration is permitted) and `await`, + so a subsequent `0` where `=` was expected is a syntax error. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function f() { + let + await 0; +} diff --git a/js/src/tests/test262/language/statements/let/syntax/let-newline-yield-in-generator-function.js b/js/src/tests/test262/language/statements/let/syntax/let-newline-yield-in-generator-function.js new file mode 100644 index 0000000000..86a3c429bf --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/let-newline-yield-in-generator-function.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Jeff Walden <jwalden+code@mit.edu> +esid: sec-let-and-const-declarations +description: > + `let yield` does not permit ASI in between, as `yield` is a BindingIdentifier +info: | + `yield` is a perfectly cromulent binding name in any context grammatically, just + prohibited by static semantics in some contexts. Therefore ASI can never apply + between `let` (where a LexicalDeclaration is permitted) and `yield`, + so a subsequent `0` where `=` was expected is a syntax error. +negative: + phase: parse + type: SyntaxError +features: [generators] +---*/ + +$DONOTEVALUATE(); + +function* f() { + let + yield 0; +} diff --git a/js/src/tests/test262/language/statements/let/syntax/let-newline-yield-in-normal-function.js b/js/src/tests/test262/language/statements/let/syntax/let-newline-yield-in-normal-function.js new file mode 100644 index 0000000000..fdf257f95f --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/let-newline-yield-in-normal-function.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-let-and-const-declarations +description: > + `let yield` does not permit ASI in between, as `yield` is a BindingIdentifier +info: | + `yield` is a perfectly cromulent binding name in any context grammatically, just + prohibited by static semantics in some contexts. Therefore ASI can never apply + between `let` (where a LexicalDeclaration is permitted) and `yield`, + so a subsequent `0` where `=` was expected is a syntax error. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function f() { + let + yield 0; +} diff --git a/js/src/tests/test262/language/statements/let/syntax/let-outer-inner-let-bindings.js b/js/src/tests/test262/language/statements/let/syntax/let-outer-inner-let-bindings.js new file mode 100644 index 0000000000..ece8f016ef --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/let-outer-inner-let-bindings.js @@ -0,0 +1,23 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + outer let binding unchanged by for-loop let binding +---*/ +// + +let x = "outer_x"; +let y = "outer_y"; + +for (let x = "inner_x", i = 0; i < 1; i++) { + let y = "inner_y"; + + assert.sameValue(x, "inner_x"); + assert.sameValue(y, "inner_y"); +} +assert.sameValue(x, "outer_x"); +assert.sameValue(y, "outer_y"); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/let/syntax/let.js b/js/src/tests/test262/language/statements/let/syntax/let.js new file mode 100644 index 0000000000..cf9bd1b53c --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/let.js @@ -0,0 +1,26 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + global and block scope let +---*/ +let x; +let y = 2; + +// Block local +{ + let y; + let x = 3; +} + +assert.sameValue(x, undefined); +assert.sameValue(y, 2); + +if (true) { + let y; + assert.sameValue(y, undefined); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/let/syntax/shell.js b/js/src/tests/test262/language/statements/let/syntax/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/shell.js diff --git a/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-case-expression-statement-list.js b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-case-expression-statement-list.js new file mode 100644 index 0000000000..79a17ed3c4 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-case-expression-statement-list.js @@ -0,0 +1,12 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let declarations with initialisers in statement positions: + case Expression : StatementList +---*/ +switch (true) { case true: let x = 1; } + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-default-statement-list.js b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-default-statement-list.js new file mode 100644 index 0000000000..0788ee9d8d --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-default-statement-list.js @@ -0,0 +1,12 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let declarations with initialisers in statement positions: + default : StatementList +---*/ +switch (true) { default: let x = 1; } + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-do-statement-while-expression.js b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-do-statement-while-expression.js new file mode 100644 index 0000000000..f452223e92 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-do-statement-while-expression.js @@ -0,0 +1,15 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let declarations with initialisers in statement positions: + do Statement while ( Expression ) +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +do let x = 1; while (false) diff --git a/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-for-statement.js b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-for-statement.js new file mode 100644 index 0000000000..cc0d1cd796 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-for-statement.js @@ -0,0 +1,15 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let declarations with initialisers in statement positions: + for ( ;;) Statement +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +for (;false;) let x = 1; diff --git a/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-if-expression-statement-else-statement.js b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-if-expression-statement-else-statement.js new file mode 100644 index 0000000000..72ef204832 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-if-expression-statement-else-statement.js @@ -0,0 +1,15 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let declarations with initialisers in statement positions: + if ( Expression ) Statement else Statement +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +if (true) {} else let x = 1; diff --git a/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-if-expression-statement.js b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-if-expression-statement.js new file mode 100644 index 0000000000..f0b34129e5 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-if-expression-statement.js @@ -0,0 +1,15 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let declarations with initialisers in statement positions: + if ( Expression ) Statement +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +if (true) let x = 1; diff --git a/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-label-statement.js b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-label-statement.js new file mode 100644 index 0000000000..55336769c3 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-label-statement.js @@ -0,0 +1,15 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let declarations with initialisers in statement positions: + label: Statement +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +label: let x = 1; diff --git a/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-while-expression-statement.js b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-while-expression-statement.js new file mode 100644 index 0000000000..eb2f85897e --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/with-initialisers-in-statement-positions-while-expression-statement.js @@ -0,0 +1,15 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let declarations with initialisers in statement positions: + while ( Expression ) Statement +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +while (false) let x = 1; diff --git a/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-case-expression-statement-list.js b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-case-expression-statement-list.js new file mode 100644 index 0000000000..089beebeb3 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-case-expression-statement-list.js @@ -0,0 +1,11 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let declarations without initialisers in statement positions: + case Expression : StatementList +---*/ +switch (true) { case true: let x; } + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-default-statement-list.js b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-default-statement-list.js new file mode 100644 index 0000000000..128f3cb6ad --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-default-statement-list.js @@ -0,0 +1,11 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let declarations without initialisers in statement positions: + default : StatementList +---*/ +switch (true) { default: let x; } + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-do-statement-while-expression.js b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-do-statement-while-expression.js new file mode 100644 index 0000000000..568b4463b5 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-do-statement-while-expression.js @@ -0,0 +1,15 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let declarations without initialisers in statement positions: + do Statement while ( Expression ) +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +do let x; while (false) diff --git a/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-for-statement.js b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-for-statement.js new file mode 100644 index 0000000000..1730e07c1a --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-for-statement.js @@ -0,0 +1,15 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let declarations without initialisers in statement positions: + for ( ;;) Statement +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +for (;false;) let x; diff --git a/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-if-expression-statement-else-statement.js b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-if-expression-statement-else-statement.js new file mode 100644 index 0000000000..bf634c5103 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-if-expression-statement-else-statement.js @@ -0,0 +1,15 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let declarations without initialisers in statement positions: + if ( Expression ) Statement else Statement +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +if (true) {} else let x; diff --git a/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-if-expression-statement.js b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-if-expression-statement.js new file mode 100644 index 0000000000..8c9ad1e56b --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-if-expression-statement.js @@ -0,0 +1,15 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let declarations without initialisers in statement positions: + if ( Expression ) Statement +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +if (true) let x; diff --git a/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-label-statement.js b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-label-statement.js new file mode 100644 index 0000000000..7298a666ad --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-label-statement.js @@ -0,0 +1,15 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let declarations without initialisers in statement positions: + label: Statement +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +label: let x; diff --git a/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-while-expression-statement.js b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-while-expression-statement.js new file mode 100644 index 0000000000..705e47e5d6 --- /dev/null +++ b/js/src/tests/test262/language/statements/let/syntax/without-initialisers-in-statement-positions-while-expression-statement.js @@ -0,0 +1,15 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + let declarations without initialisers in statement positions: + while ( Expression ) Statement +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +while (false) let x; |