diff --git a/test/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-1.js b/test/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-1.js new file mode 100644 index 0000000000..e979fd17cb --- /dev/null +++ b/test/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-1.js @@ -0,0 +1,18 @@ +// Copyright (C) Copyright 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: > + finally block let declaration only shadows outer parameter value 1 +---*/ +try { + (function(x) { + try { + let x = 'inner'; + throw 0; + } finally { + assert.sameValue(x, 'outer'); + } + })('outer'); +} catch (e) {} + diff --git a/test/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-2.js b/test/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-2.js new file mode 100644 index 0000000000..49a69b91d7 --- /dev/null +++ b/test/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-2.js @@ -0,0 +1,21 @@ +// Copyright (C) Copyright 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: > + finally block let declaration only shadows outer parameter value 2 +---*/ +(function(x) { + try { + let x = 'middle'; + { + let x = 'inner'; + throw 0; + } + } catch(e) { + + } finally { + assert.sameValue(x, 'outer'); + } +})('outer'); + diff --git a/test/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-1.js b/test/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-1.js new file mode 100644 index 0000000000..43aad6ab24 --- /dev/null +++ b/test/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-1.js @@ -0,0 +1,15 @@ +// Copyright (C) Copyright 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: > + for loop block let declaration only shadows outer parameter value 1 +---*/ +(function(x) { + for (var i = 0; i < 10; ++i) { + let x = 'inner' + i; + continue; + } + assert.sameValue(x, 'outer'); +})('outer'); + diff --git a/test/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-2.js b/test/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-2.js new file mode 100644 index 0000000000..93b7daa94d --- /dev/null +++ b/test/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-2.js @@ -0,0 +1,18 @@ +// Copyright (C) Copyright 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: > + for loop block let declaration only shadows outer parameter value 2 +---*/ +(function(x) { + label: for (var i = 0; i < 10; ++i) { + let x = 'middle' + i; + for (var j = 0; j < 10; ++j) { + let x = 'inner' + j; + continue label; + } + } + assert.sameValue(x, 'outer'); +})('outer'); + diff --git a/test/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-1.js b/test/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-1.js new file mode 100644 index 0000000000..5625eddc8b --- /dev/null +++ b/test/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-1.js @@ -0,0 +1,15 @@ +// Copyright (C) Copyright 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: > + nested block let declaration only shadows outer parameter value 1 +---*/ +(function(x) { + label: { + let x = 'inner'; + break label; + } + assert.sameValue(x, 'outer'); +})('outer'); + diff --git a/test/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-2.js b/test/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-2.js new file mode 100644 index 0000000000..9a668e26b5 --- /dev/null +++ b/test/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-2.js @@ -0,0 +1,18 @@ +// Copyright (C) Copyright 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: > + nested block let declaration only shadows outer parameter value 2 +---*/ +(function(x) { + label: { + let x = 'middle'; + { + let x = 'inner'; + break label; + } + } + assert.sameValue(x, 'outer'); +})('outer'); + diff --git a/test/language/block-scope/leave/outermost-binding-updated-in-catch-block-nested-block-let-declaration-unseen-outside-of-block.js b/test/language/block-scope/leave/outermost-binding-updated-in-catch-block-nested-block-let-declaration-unseen-outside-of-block.js new file mode 100644 index 0000000000..071691355c --- /dev/null +++ b/test/language/block-scope/leave/outermost-binding-updated-in-catch-block-nested-block-let-declaration-unseen-outside-of-block.js @@ -0,0 +1,30 @@ +// Copyright (C) Copyright 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: > + outermost binding updated in catch block; nested block let declaration unseen outside of block +---*/ +var caught = false; +try { + { + let xx = 18; + throw 25; + } +} catch (e) { + caught = true; + assert.sameValue(e, 25); + (function () { + try { + // NOTE: This checks that the block scope containing xx has been + // removed from the context chain. + assert.sameValue(xx, undefined); + eval('xx'); + assert(false); // should not reach here + } catch (e2) { + assert(e2 instanceof ReferenceError); + } + })(); +} +assert(caught); + diff --git a/test/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-1.js b/test/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-1.js new file mode 100644 index 0000000000..bf1a0d12ed --- /dev/null +++ b/test/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-1.js @@ -0,0 +1,16 @@ +// Copyright (C) Copyright 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: > + try block let declaration only shadows outer parameter value 1 +---*/ +(function(x) { + try { + let x = 'inner'; + throw 0; + } catch (e) { + assert.sameValue(x, 'outer'); + } +})('outer'); + diff --git a/test/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-2.js b/test/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-2.js new file mode 100644 index 0000000000..bbbf5469e9 --- /dev/null +++ b/test/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-2.js @@ -0,0 +1,19 @@ +// Copyright (C) Copyright 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: > + try block let declaration only shadows outer parameter value 2 +---*/ +(function(x) { + try { + let x = 'middle'; + { + let x = 'inner'; + throw 0; + } + } catch (e) { + assert.sameValue(x, 'outer'); + } +})('outer'); + diff --git a/test/language/block-scope/leave/verify-context-in-finally-block.js b/test/language/block-scope/leave/verify-context-in-finally-block.js new file mode 100644 index 0000000000..9eeadaacd2 --- /dev/null +++ b/test/language/block-scope/leave/verify-context-in-finally-block.js @@ -0,0 +1,20 @@ +// Copyright (C) Copyright 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: > + verify context in finally block 1 +---*/ +function f() {} + +(function(x) { + try { + let x = 'inner'; + throw 0; + } catch(e) { + + } finally { + f(); + assert.sameValue(x, 'outer'); + } +})('outer'); diff --git a/test/language/block-scope/leave/verify-context-in-for-loop-block.js b/test/language/block-scope/leave/verify-context-in-for-loop-block.js new file mode 100644 index 0000000000..ff0fee3709 --- /dev/null +++ b/test/language/block-scope/leave/verify-context-in-for-loop-block.js @@ -0,0 +1,18 @@ +// Copyright (C) Copyright 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: > + verify context in for loop block 2 +---*/ +function f() {} + +(function(x) { + for (var i = 0; i < 10; ++i) { + let x = 'inner'; + continue; + } + f(); + assert.sameValue(x, 'outer'); +})('outer'); + diff --git a/test/language/block-scope/leave/verify-context-in-labelled-block.js b/test/language/block-scope/leave/verify-context-in-labelled-block.js new file mode 100644 index 0000000000..2e43de15ba --- /dev/null +++ b/test/language/block-scope/leave/verify-context-in-labelled-block.js @@ -0,0 +1,18 @@ +// Copyright (C) Copyright 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: > + verify context in labelled block 1 +---*/ +function f() {} + +(function(x) { + label: { + let x = 'inner'; + break label; + } + f(); // The context could be restored from the stack after the call. + assert.sameValue(x, 'outer'); +})('outer'); + diff --git a/test/language/block-scope/leave/verify-context-in-try-block.js b/test/language/block-scope/leave/verify-context-in-try-block.js new file mode 100644 index 0000000000..d8f540cd34 --- /dev/null +++ b/test/language/block-scope/leave/verify-context-in-try-block.js @@ -0,0 +1,19 @@ +// Copyright (C) Copyright 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: > + verify context in try block 1 +---*/ +function f() {} + +(function(x) { + try { + let x = 'inner'; + throw 0; + } catch (e) { + f(); + assert.sameValue(x, 'outer'); + } +})('outer'); + diff --git a/test/language/block-scope/leave/x-after-break-to-label.js b/test/language/block-scope/leave/x-after-break-to-label.js new file mode 100644 index 0000000000..7ec8612cac --- /dev/null +++ b/test/language/block-scope/leave/x-after-break-to-label.js @@ -0,0 +1,17 @@ +// Copyright (C) Copyright 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: > + x after break to label +---*/ +{ + let x = 2; + L: { + let x = 3; + assert.sameValue(x, 3); + break L; + assert(false); + } + assert.sameValue(x, 2); +} diff --git a/test/language/block-scope/leave/x-before-continue.js b/test/language/block-scope/leave/x-before-continue.js new file mode 100644 index 0000000000..9e8041b92a --- /dev/null +++ b/test/language/block-scope/leave/x-before-continue.js @@ -0,0 +1,18 @@ +// Copyright (C) Copyright 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: > + x before continue +---*/ +do { + let x = 4; + assert.sameValue(x, 4); + { + let x = 5; + assert.sameValue(x, 5); + continue; + assert(false); + } +} while (false); + diff --git a/test/language/block-scope/return-from/block-const.js b/test/language/block-scope/return-from/block-const.js new file mode 100644 index 0000000000..ad08438220 --- /dev/null +++ b/test/language/block-scope/return-from/block-const.js @@ -0,0 +1,16 @@ +// Copyright (C) Copyright 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: > + return from block +---*/ +function fn() { + const u = 3; + { + const v = 6; + return u + v; + } +} +assert.sameValue(fn(), 9); + diff --git a/test/language/block-scope/return-from/block-let.js b/test/language/block-scope/return-from/block-let.js new file mode 100644 index 0000000000..f0505ede74 --- /dev/null +++ b/test/language/block-scope/return-from/block-let.js @@ -0,0 +1,16 @@ +// Copyright (C) Copyright 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: > + return from block +---*/ +function fn() { + let x = 3; + { + let y = 6; + return x + y; + } +} +assert.sameValue(fn(), 9); + diff --git a/test/language/block-scope/semantics/const/block-local-closure-get-before-initialization.js b/test/language/block-scope/semantics/const/block-local-closure-get-before-initialization.js new file mode 100644 index 0000000000..342fb1a73d --- /dev/null +++ b/test/language/block-scope/semantics/const/block-local-closure-get-before-initialization.js @@ -0,0 +1,15 @@ +// Copyright (C) Copyright 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: > + const: block local closure [[Get]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +{ + function f() { return x + 1; } + f(); + const x = 1; +} + diff --git a/test/language/block-scope/semantics/const/block-local-use-before-initialization-in-declaration-statement.js b/test/language/block-scope/semantics/const/block-local-use-before-initialization-in-declaration-statement.js new file mode 100644 index 0000000000..a95cc15d74 --- /dev/null +++ b/test/language/block-scope/semantics/const/block-local-use-before-initialization-in-declaration-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: > + const: block local use before initialization in declaration statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +{ + const x = x + 1; +} diff --git a/test/language/block-scope/semantics/const/block-local-use-before-initialization-in-prior-statement.js b/test/language/block-scope/semantics/const/block-local-use-before-initialization-in-prior-statement.js new file mode 100644 index 0000000000..10523d69af --- /dev/null +++ b/test/language/block-scope/semantics/const/block-local-use-before-initialization-in-prior-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: > + const: block local use before initialization in prior statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +{ + x; const x = 1; +} diff --git a/test/language/block-scope/semantics/const/function-local-closure-get-before-initialization.js b/test/language/block-scope/semantics/const/function-local-closure-get-before-initialization.js new file mode 100644 index 0000000000..49fa8a3dc9 --- /dev/null +++ b/test/language/block-scope/semantics/const/function-local-closure-get-before-initialization.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 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: > + const: function local closure [[Get]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +(function() { + function f() { return x + 1; } + f(); + const x = 1; +}()); diff --git a/test/language/block-scope/semantics/const/function-local-use-before-initialization-in-declaration-statement.js b/test/language/block-scope/semantics/const/function-local-use-before-initialization-in-declaration-statement.js new file mode 100644 index 0000000000..8ae0722b1a --- /dev/null +++ b/test/language/block-scope/semantics/const/function-local-use-before-initialization-in-declaration-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: > + const: function local use before initialization in declaration statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +(function() { + const x = x + 1; +}()); diff --git a/test/language/block-scope/semantics/const/function-local-use-before-initialization-in-prior-statement.js b/test/language/block-scope/semantics/const/function-local-use-before-initialization-in-prior-statement.js new file mode 100644 index 0000000000..9e853029ce --- /dev/null +++ b/test/language/block-scope/semantics/const/function-local-use-before-initialization-in-prior-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: > + const: function local use before initialization in prior statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +(function() { + x; const x = 1; +}()); diff --git a/test/language/block-scope/semantics/const/global-closure-get-before-initialization.js b/test/language/block-scope/semantics/const/global-closure-get-before-initialization.js new file mode 100644 index 0000000000..68674108df --- /dev/null +++ b/test/language/block-scope/semantics/const/global-closure-get-before-initialization.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: > + const: global closure [[Get]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +function f() { return x + 1; } +f(); +const x = 1; diff --git a/test/language/block-scope/semantics/const/global-use-before-initialization-in-declaration-statement.js b/test/language/block-scope/semantics/const/global-use-before-initialization-in-declaration-statement.js new file mode 100644 index 0000000000..37462a91f8 --- /dev/null +++ b/test/language/block-scope/semantics/const/global-use-before-initialization-in-declaration-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const: global use before initialization in declaration statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +const x = x + 1; diff --git a/test/language/block-scope/semantics/const/global-use-before-initialization-in-prior-statement.js b/test/language/block-scope/semantics/const/global-use-before-initialization-in-prior-statement.js new file mode 100644 index 0000000000..0dce38e5bf --- /dev/null +++ b/test/language/block-scope/semantics/const/global-use-before-initialization-in-prior-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const: global use before initialization in prior statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +x; const x = 1; diff --git a/test/language/block-scope/semantics/let/block-local-closure-get-before-initialization.js b/test/language/block-scope/semantics/let/block-local-closure-get-before-initialization.js new file mode 100644 index 0000000000..32eb4bb6f0 --- /dev/null +++ b/test/language/block-scope/semantics/let/block-local-closure-get-before-initialization.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 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: block local closure [[Get]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +{ + function f() { return x + 1; } + f(); + let x; +} diff --git a/test/language/block-scope/semantics/let/block-local-closure-set-before-initialization.js b/test/language/block-scope/semantics/let/block-local-closure-set-before-initialization.js new file mode 100644 index 0000000000..04232246d6 --- /dev/null +++ b/test/language/block-scope/semantics/let/block-local-closure-set-before-initialization.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 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: block local closure [[Set]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +{ + function f() { x = 1; } + f(); + let x; +} diff --git a/test/language/block-scope/semantics/let/block-local-use-before-initialization-in-declaration-statement.js b/test/language/block-scope/semantics/let/block-local-use-before-initialization-in-declaration-statement.js new file mode 100644 index 0000000000..6e9536d054 --- /dev/null +++ b/test/language/block-scope/semantics/let/block-local-use-before-initialization-in-declaration-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: block local use before initialization in declaration statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +{ + let x = x + 1; +} diff --git a/test/language/block-scope/semantics/let/block-local-use-before-initialization-in-prior-statement.js b/test/language/block-scope/semantics/let/block-local-use-before-initialization-in-prior-statement.js new file mode 100644 index 0000000000..ca21029312 --- /dev/null +++ b/test/language/block-scope/semantics/let/block-local-use-before-initialization-in-prior-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: block local use before initialization in prior statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +{ + x; let x; +} diff --git a/test/language/block-scope/semantics/let/function-local-closure-get-before-initialization.js b/test/language/block-scope/semantics/let/function-local-closure-get-before-initialization.js new file mode 100644 index 0000000000..2d84411757 --- /dev/null +++ b/test/language/block-scope/semantics/let/function-local-closure-get-before-initialization.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 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: function local closure [[Get]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +(function() { + function f() { return x + 1; } + f(); + let x; +}()); diff --git a/test/language/block-scope/semantics/let/function-local-closure-set-before-initialization.js b/test/language/block-scope/semantics/let/function-local-closure-set-before-initialization.js new file mode 100644 index 0000000000..857e9abf86 --- /dev/null +++ b/test/language/block-scope/semantics/let/function-local-closure-set-before-initialization.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 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: function local closure [[Set]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +(function() { + function f() { x = 1; } + f(); + let x; +}()); diff --git a/test/language/block-scope/semantics/let/function-local-use-before-initialization-in-declaration-statement.js b/test/language/block-scope/semantics/let/function-local-use-before-initialization-in-declaration-statement.js new file mode 100644 index 0000000000..3bd63de4ba --- /dev/null +++ b/test/language/block-scope/semantics/let/function-local-use-before-initialization-in-declaration-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: function local use before initialization in declaration statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +(function() { + let x = x + 1; +}()); diff --git a/test/language/block-scope/semantics/let/function-local-use-before-initialization-in-prior-statement.js b/test/language/block-scope/semantics/let/function-local-use-before-initialization-in-prior-statement.js new file mode 100644 index 0000000000..9d9c2bbe40 --- /dev/null +++ b/test/language/block-scope/semantics/let/function-local-use-before-initialization-in-prior-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: function local use before initialization in prior statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +(function() { + x; let x; +}()); diff --git a/test/language/block-scope/semantics/let/global-closure-get-before-initialization.js b/test/language/block-scope/semantics/let/global-closure-get-before-initialization.js new file mode 100644 index 0000000000..5b4af8befb --- /dev/null +++ b/test/language/block-scope/semantics/let/global-closure-get-before-initialization.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: global closure [[Get]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +function f() { return x + 1; } +f(); +let x; diff --git a/test/language/block-scope/semantics/let/global-closure-set-before-initialization.js b/test/language/block-scope/semantics/let/global-closure-set-before-initialization.js new file mode 100644 index 0000000000..cf0c32bc5e --- /dev/null +++ b/test/language/block-scope/semantics/let/global-closure-set-before-initialization.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: global closure [[Set]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +function f() { x = 1; } +f(); +let x; diff --git a/test/language/block-scope/semantics/let/global-use-before-initialization-in-declaration-statement.js b/test/language/block-scope/semantics/let/global-use-before-initialization-in-declaration-statement.js new file mode 100644 index 0000000000..7ba56f6e7d --- /dev/null +++ b/test/language/block-scope/semantics/let/global-use-before-initialization-in-declaration-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: global use before initialization in declaration statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +let x = x + 1; diff --git a/test/language/block-scope/semantics/let/global-use-before-initialization-in-prior-statement.js b/test/language/block-scope/semantics/let/global-use-before-initialization-in-prior-statement.js new file mode 100644 index 0000000000..e327554fe8 --- /dev/null +++ b/test/language/block-scope/semantics/let/global-use-before-initialization-in-prior-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: global use before initialization in prior statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +x; let x; diff --git a/test/language/block-scope/shadowing/catch-parameter-shadowing-catch-parameter.js b/test/language/block-scope/shadowing/catch-parameter-shadowing-catch-parameter.js new file mode 100644 index 0000000000..551a7608c4 --- /dev/null +++ b/test/language/block-scope/shadowing/catch-parameter-shadowing-catch-parameter.js @@ -0,0 +1,26 @@ +// Copyright (C) Copyright 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: > + catch parameter shadowing catch parameter +---*/ +function fn() { + var c = 1; + try { + throw 'stuff3'; + } catch (c) { + try { + throw 'stuff4'; + } catch(c) { + assert.sameValue(c,'stuff4'); + // catch parameter shadowing catch parameter + c = 3; + assert.sameValue(c, 3); + } + assert.sameValue(c, 'stuff3'); + } + assert.sameValue(c, 1); +} +fn(1); + diff --git a/test/language/block-scope/shadowing/catch-parameter-shadowing-function-parameter-name.js b/test/language/block-scope/shadowing/catch-parameter-shadowing-function-parameter-name.js new file mode 100644 index 0000000000..6fc91f4351 --- /dev/null +++ b/test/language/block-scope/shadowing/catch-parameter-shadowing-function-parameter-name.js @@ -0,0 +1,19 @@ +// Copyright (C) Copyright 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: > + catch parameter shadowing function parameter name +---*/ +function fn(a) { + try { + throw 'stuff1'; + } catch (a) { + assert.sameValue(a, 'stuff1'); + // catch parameter shadowing function parameter name + a = 2; + assert.sameValue(a, 2); + } +} +fn(1); + diff --git a/test/language/block-scope/shadowing/catch-parameter-shadowing-let-declaration.js b/test/language/block-scope/shadowing/catch-parameter-shadowing-let-declaration.js new file mode 100644 index 0000000000..b67af4f614 --- /dev/null +++ b/test/language/block-scope/shadowing/catch-parameter-shadowing-let-declaration.js @@ -0,0 +1,20 @@ +// Copyright (C) Copyright 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: > + catch parameter shadowing let declaration +---*/ +{ + let a = 3; + try { + throw 'stuff2'; + } catch (a) { + assert.sameValue(a, 'stuff2'); + // catch parameter shadowing let declaration + a = 4; + assert.sameValue(a, 4); + } + assert.sameValue(a, 3); +} + diff --git a/test/language/block-scope/shadowing/catch-parameter-shadowing-var-variable.js b/test/language/block-scope/shadowing/catch-parameter-shadowing-var-variable.js new file mode 100644 index 0000000000..c499f2bdee --- /dev/null +++ b/test/language/block-scope/shadowing/catch-parameter-shadowing-var-variable.js @@ -0,0 +1,19 @@ +// Copyright (C) Copyright 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: > + catch parameter shadowing var variable +---*/ +function fn() { + var a = 1; + try { + throw 'stuff3'; + } catch (a) { + // catch parameter shadowing var variable + assert.sameValue(a, 'stuff3'); + } + assert.sameValue(a, 1); +} +fn(); + diff --git a/test/language/block-scope/shadowing/const-declaration-shadowing-catch-parameter.js b/test/language/block-scope/shadowing/const-declaration-shadowing-catch-parameter.js new file mode 100644 index 0000000000..ba690dffc3 --- /dev/null +++ b/test/language/block-scope/shadowing/const-declaration-shadowing-catch-parameter.js @@ -0,0 +1,23 @@ +// Copyright (C) Copyright 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: > + const declaration shadowing catch parameter +---*/ +function fn() { + var a = 1; + try { + throw 'stuff3'; + } catch (a) { + { + // const declaration shadowing catch parameter + const a = 3; + assert.sameValue(a, 3); + } + assert.sameValue(a, 'stuff3'); + } + assert.sameValue(a, 1); +} +fn(); + diff --git a/test/language/block-scope/shadowing/const-declarations-shadowing-parameter-name-let-const-and-var-variables.js b/test/language/block-scope/shadowing/const-declarations-shadowing-parameter-name-let-const-and-var-variables.js new file mode 100644 index 0000000000..f8a1120291 --- /dev/null +++ b/test/language/block-scope/shadowing/const-declarations-shadowing-parameter-name-let-const-and-var-variables.js @@ -0,0 +1,29 @@ +// Copyright (C) Copyright 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: > + const declarations shadowing parameter name, let, const and var variables +---*/ +function fn(a) { + let b = 1; + var c = 1; + const d = 1; + { + const a = 2; + const b = 2; + const c = 2; + const d = 2; + assert.sameValue(a, 2); + assert.sameValue(b, 2); + assert.sameValue(c, 2); + assert.sameValue(d, 2); + } + + assert.sameValue(a, 1); + assert.sameValue(b, 1); + assert.sameValue(c, 1); + assert.sameValue(d, 1); +} +fn(1); + diff --git a/test/language/block-scope/shadowing/dynamic-lookup-from-closure.js b/test/language/block-scope/shadowing/dynamic-lookup-from-closure.js new file mode 100644 index 0000000000..c42128aa9e --- /dev/null +++ b/test/language/block-scope/shadowing/dynamic-lookup-from-closure.js @@ -0,0 +1,28 @@ +// Copyright (C) Copyright 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: > + dynamic lookup from closure +---*/ +function fn(one) { + var x = one + 1; + let y = one + 2; + const u = one + 4; + { + let z = one + 3; + const v = one + 5; + function f() { + assert.sameValue(one, 1); + assert.sameValue(x, 2); + assert.sameValue(y, 3); + assert.sameValue(z, 4); + assert.sameValue(u, 5); + assert.sameValue(v, 6); + } + + f(); + } +} +fn(1); + diff --git a/test/language/block-scope/shadowing/dynamic-lookup-in-and-through-block-contexts.js b/test/language/block-scope/shadowing/dynamic-lookup-in-and-through-block-contexts.js new file mode 100644 index 0000000000..39654afa9f --- /dev/null +++ b/test/language/block-scope/shadowing/dynamic-lookup-in-and-through-block-contexts.js @@ -0,0 +1,25 @@ +// Copyright (C) Copyright 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: > + dynamic lookup in and through block contexts +---*/ +function fn(one) { + var x = one + 1; + let y = one + 2; + const u = one + 4; + { + let z = one + 3; + const v = one + 5; + assert.sameValue(one, 1); + assert.sameValue(x, 2); + assert.sameValue(y, 3); + assert.sameValue(z, 4); + assert.sameValue(u, 5); + assert.sameValue(v, 6); + } +} + +fn(1); + diff --git a/test/language/block-scope/shadowing/hoisting-var-declarations-out-of-blocks.js b/test/language/block-scope/shadowing/hoisting-var-declarations-out-of-blocks.js new file mode 100644 index 0000000000..9be40074d5 --- /dev/null +++ b/test/language/block-scope/shadowing/hoisting-var-declarations-out-of-blocks.js @@ -0,0 +1,17 @@ +// Copyright (C) Copyright 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: > + hoisting var declarations out of blocks +---*/ +function fn() { + { + var x = 1; + var y; + } + assert.sameValue(x, 1); + assert.sameValue(y, undefined); +} +fn(); + diff --git a/test/language/block-scope/shadowing/let-declaration-shadowing-catch-parameter.js b/test/language/block-scope/shadowing/let-declaration-shadowing-catch-parameter.js new file mode 100644 index 0000000000..63aa11749b --- /dev/null +++ b/test/language/block-scope/shadowing/let-declaration-shadowing-catch-parameter.js @@ -0,0 +1,18 @@ +// Copyright (C) Copyright 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 declaration shadowing catch parameter +---*/ +try { + throw 'stuff1'; +} catch (a) { + { + // let declaration shadowing catch parameter + let a = 3; + assert.sameValue(a, 3); + } + assert.sameValue(a, 'stuff1'); +} + diff --git a/test/language/block-scope/shadowing/let-declarations-shadowing-parameter-name-let-const-and-var.js b/test/language/block-scope/shadowing/let-declarations-shadowing-parameter-name-let-const-and-var.js new file mode 100644 index 0000000000..a1e0ebe3a6 --- /dev/null +++ b/test/language/block-scope/shadowing/let-declarations-shadowing-parameter-name-let-const-and-var.js @@ -0,0 +1,24 @@ +// Copyright (C) Copyright 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 shadowing parameter name, let, const and var +---*/ +function fn(a) { + let b = 1; + var c = 1; + const d = 1; + { + let a = 2; + let b = 2; + let c = 2; + let d = 2; + assert.sameValue(a, 2); + assert.sameValue(b, 2); + assert.sameValue(c, 2); + assert.sameValue(d, 2); + } +} +fn(1); + diff --git a/test/language/block-scope/shadowing/lookup-from-closure.js b/test/language/block-scope/shadowing/lookup-from-closure.js new file mode 100644 index 0000000000..76f567533e --- /dev/null +++ b/test/language/block-scope/shadowing/lookup-from-closure.js @@ -0,0 +1,28 @@ +// Copyright (C) Copyright 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: > + lookup from closure +---*/ +function f5(one) { + var x = one + 1; + let y = one + 2; + const u = one + 4; + { + let z = one + 3; + const v = one + 5; + function f() { + assert.sameValue(one, 1); + assert.sameValue(x, 2); + assert.sameValue(y, 3); + assert.sameValue(z, 4); + assert.sameValue(u, 5); + assert.sameValue(v, 6); + } + + f(); + } +} +f5(1); + diff --git a/test/language/block-scope/shadowing/lookup-in-and-through-block-contexts.js b/test/language/block-scope/shadowing/lookup-in-and-through-block-contexts.js new file mode 100644 index 0000000000..d970491089 --- /dev/null +++ b/test/language/block-scope/shadowing/lookup-in-and-through-block-contexts.js @@ -0,0 +1,25 @@ +// Copyright (C) Copyright 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: > + lookup in and through block contexts +---*/ +function fn(one) { + var x = one + 1; + let y = one + 2; + const u = one + 4; + { + let z = one + 3; + const v = one + 5; + assert.sameValue(one, 1); + assert.sameValue(x, 2); + assert.sameValue(y, 3); + assert.sameValue(z, 4); + assert.sameValue(u, 5); + assert.sameValue(v, 6); + } +} + +fn(1); + diff --git a/test/language/block-scope/shadowing/parameter-name-shadowing-catch-parameter.js b/test/language/block-scope/shadowing/parameter-name-shadowing-catch-parameter.js new file mode 100644 index 0000000000..b14b1ec5dd --- /dev/null +++ b/test/language/block-scope/shadowing/parameter-name-shadowing-catch-parameter.js @@ -0,0 +1,23 @@ +// Copyright (C) Copyright 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: > + parameter name shadowing catch parameter +---*/ +function fn() { + var c = 1; + try { + throw 'stuff3'; + } catch (c) { + (function(c) { + // parameter name shadowing catch parameter + c = 3; + assert.sameValue(c, 3); + })(); + assert.sameValue(c, 'stuff3'); + } + assert.sameValue(c, 1); +} +fn(); + diff --git a/test/language/block-scope/shadowing/parameter-name-shadowing-parameter-name-let-const-and-var.js b/test/language/block-scope/shadowing/parameter-name-shadowing-parameter-name-let-const-and-var.js new file mode 100644 index 0000000000..5962c91074 --- /dev/null +++ b/test/language/block-scope/shadowing/parameter-name-shadowing-parameter-name-let-const-and-var.js @@ -0,0 +1,32 @@ +// Copyright (C) Copyright 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: > + parameter name shadowing parameter name, let, const and var +---*/ +function fn(a) { + let b = 1; + var c = 1; + const d = 1; + + (function(a, b, c, d) { + a = 2; + b = 2; + c = 2; + d = 2; + + assert.sameValue(a, 2); + assert.sameValue(b, 2); + assert.sameValue(c, 2); + assert.sameValue(d, 2); + })(1, 1); + + assert.sameValue(a, 1); + assert.sameValue(b, 1); + assert.sameValue(c, 1); + assert.sameValue(d, 1); +} + +fn(1); + diff --git a/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-mixed-with-without-initialiser.js b/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-mixed-with-without-initialiser.js new file mode 100644 index 0000000000..7f9dadbb6a --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-mixed-with-without-initialiser.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations mixed: with, without initialiser +negative: SyntaxError +---*/ +const x = 1, y; + diff --git a/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-mixed-without-with-initialiser.js b/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-mixed-without-with-initialiser.js new file mode 100644 index 0000000000..499b2f6bac --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-mixed-without-with-initialiser.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations mixed: without, with initialiser +negative: SyntaxError +---*/ +const x, y = 1; + diff --git a/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-without-initialiser.js b/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-without-initialiser.js new file mode 100644 index 0000000000..eb25aed37c --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-without-initialiser.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations without initialiser +negative: SyntaxError +---*/ +const x; + diff --git a/test/language/block-scope/syntax/const-declaration/with-initializer-case-expression-statement-list.js b/test/language/block-scope/syntax/const-declaration/with-initializer-case-expression-statement-list.js new file mode 100644 index 0000000000..bfbe27642e --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/with-initializer-case-expression-statement-list.js @@ -0,0 +1,9 @@ +// Copyright (C) Copyright 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: > + const declarations with initialisers in statement positions: + case Expression : StatementList +---*/ +switch (true) { case true: const x = 1; } diff --git a/test/language/block-scope/syntax/const-declaration/with-initializer-default-statement-list.js b/test/language/block-scope/syntax/const-declaration/with-initializer-default-statement-list.js new file mode 100644 index 0000000000..da83201112 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/with-initializer-default-statement-list.js @@ -0,0 +1,9 @@ +// Copyright (C) Copyright 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: > + const declarations with initialisers in statement positions: + default : StatementList +---*/ +switch (true) { default: const x = 1; } diff --git a/test/language/block-scope/syntax/const-declaration/with-initializer-do-statement-while-expression.js b/test/language/block-scope/syntax/const-declaration/with-initializer-do-statement-while-expression.js new file mode 100644 index 0000000000..f9cb345698 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/with-initializer-do-statement-while-expression.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations with initialisers in statement positions: + do Statement while ( Expression ) +negative: SyntaxError +---*/ +do const x = 1; while (false) diff --git a/test/language/block-scope/syntax/const-declaration/with-initializer-for-statement.js b/test/language/block-scope/syntax/const-declaration/with-initializer-for-statement.js new file mode 100644 index 0000000000..9b3268aa8a --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/with-initializer-for-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations with initialisers in statement positions: + for ( ;;) Statement +negative: SyntaxError +---*/ +for (;false;) const x = 1; diff --git a/test/language/block-scope/syntax/const-declaration/with-initializer-if-expression-statement-else-statement.js b/test/language/block-scope/syntax/const-declaration/with-initializer-if-expression-statement-else-statement.js new file mode 100644 index 0000000000..f451958439 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/with-initializer-if-expression-statement-else-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations with initialisers in statement positions: + if ( Expression ) Statement else Statement +negative: SyntaxError +---*/ +if (true) {} else const x = 1; diff --git a/test/language/block-scope/syntax/const-declaration/with-initializer-if-expression-statement.js b/test/language/block-scope/syntax/const-declaration/with-initializer-if-expression-statement.js new file mode 100644 index 0000000000..dada7d9803 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/with-initializer-if-expression-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations with initialisers in statement positions: + if ( Expression ) Statement +negative: SyntaxError +---*/ +if (true) const x = 1; diff --git a/test/language/block-scope/syntax/const-declaration/with-initializer-label-statement.js b/test/language/block-scope/syntax/const-declaration/with-initializer-label-statement.js new file mode 100644 index 0000000000..6e34c42c4e --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/with-initializer-label-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations with initialisers in statement positions: + label: Statement +negative: SyntaxError +---*/ +label: const x = 1; diff --git a/test/language/block-scope/syntax/const-declaration/with-initializer-while-expression-statement.js b/test/language/block-scope/syntax/const-declaration/with-initializer-while-expression-statement.js new file mode 100644 index 0000000000..7b6ac9f4c8 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/with-initializer-while-expression-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations with initialisers in statement positions: + while ( Expression ) Statement +negative: SyntaxError +---*/ +while (false) const x = 1; diff --git a/test/language/block-scope/syntax/const-declaration/without-initializer-case-expression-statement-list.js b/test/language/block-scope/syntax/const-declaration/without-initializer-case-expression-statement-list.js new file mode 100644 index 0000000000..6774916c92 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/without-initializer-case-expression-statement-list.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations without initialisers in statement positions: + case Expression : StatementList +negative: SyntaxError +---*/ +switch (true) { case true: const x; } diff --git a/test/language/block-scope/syntax/const-declaration/without-initializer-default-statement-list.js b/test/language/block-scope/syntax/const-declaration/without-initializer-default-statement-list.js new file mode 100644 index 0000000000..e8b991af36 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/without-initializer-default-statement-list.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations without initialisers in statement positions: + default : StatementList +negative: SyntaxError +---*/ +switch (true) { default: const x; } diff --git a/test/language/block-scope/syntax/const-declaration/without-initializer-do-statement-while-expression.js b/test/language/block-scope/syntax/const-declaration/without-initializer-do-statement-while-expression.js new file mode 100644 index 0000000000..a25b68e02a --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/without-initializer-do-statement-while-expression.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations without initialisers in statement positions: + do Statement while ( Expression ) +negative: SyntaxError +---*/ +do const x; while (false) diff --git a/test/language/block-scope/syntax/const-declaration/without-initializer-for-statement.js b/test/language/block-scope/syntax/const-declaration/without-initializer-for-statement.js new file mode 100644 index 0000000000..761519eaa3 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/without-initializer-for-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations without initialisers in statement positions: + for ( ;;) Statement +negative: SyntaxError +---*/ +for (;false;) const x; diff --git a/test/language/block-scope/syntax/const-declaration/without-initializer-if-expression-statement-else-statement.js b/test/language/block-scope/syntax/const-declaration/without-initializer-if-expression-statement-else-statement.js new file mode 100644 index 0000000000..281f7192e7 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/without-initializer-if-expression-statement-else-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations without initialisers in statement positions: + if ( Expression ) Statement else Statement +negative: SyntaxError +---*/ +if (true) {} else const x; diff --git a/test/language/block-scope/syntax/const-declaration/without-initializer-if-expression-statement.js b/test/language/block-scope/syntax/const-declaration/without-initializer-if-expression-statement.js new file mode 100644 index 0000000000..8eb91adbf4 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/without-initializer-if-expression-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations without initialisers in statement positions: + if ( Expression ) Statement +negative: SyntaxError +---*/ +if (true) const x; diff --git a/test/language/block-scope/syntax/const-declaration/without-initializer-label-statement.js b/test/language/block-scope/syntax/const-declaration/without-initializer-label-statement.js new file mode 100644 index 0000000000..f7d8644064 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/without-initializer-label-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations without initialisers in statement positions: + label: Statement +negative: SyntaxError +---*/ +label: const x; diff --git a/test/language/block-scope/syntax/const-declaration/without-initializer-while-expression-statement.js b/test/language/block-scope/syntax/const-declaration/without-initializer-while-expression-statement.js new file mode 100644 index 0000000000..d6b74ca657 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/without-initializer-while-expression-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + const declarations without initialisers in statement positions: + while ( Expression ) Statement +negative: SyntaxError +---*/ +while (false) const x; diff --git a/test/language/block-scope/syntax/for-in/acquire-properties-from-array.js b/test/language/block-scope/syntax/for-in/acquire-properties-from-array.js new file mode 100644 index 0000000000..ba30659308 --- /dev/null +++ b/test/language/block-scope/syntax/for-in/acquire-properties-from-array.js @@ -0,0 +1,21 @@ +// Copyright (C) Copyright 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: > + for-in to acquire properties from array +includes: [compareArray.js] +---*/ +function props(x) { + var array = []; + for (let p in x) array.push(p); + return array.sort(); +} + +assert.sameValue(props([]).length, 0); +assert.sameValue(props([1]).length, 1); +assert.sameValue(props([1,2]).length, 2); + +assert(compareArray(props([1]), ["0"])); +assert(compareArray(props([1,2]), ["0", "1"])); +assert(compareArray(props([1,2,3]), ["0", "1", "2"])); diff --git a/test/language/block-scope/syntax/for-in/acquire-properties-from-object.js b/test/language/block-scope/syntax/for-in/acquire-properties-from-object.js new file mode 100644 index 0000000000..59f21cec33 --- /dev/null +++ b/test/language/block-scope/syntax/for-in/acquire-properties-from-object.js @@ -0,0 +1,21 @@ +// Copyright (C) Copyright 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: > + for-in to acquire properties from object +includes: [compareArray.js] +---*/ +function props(x) { + var array = []; + for (let p in x) array.push(p); + return array.sort(); +} + +assert.sameValue(props({}).length, 0); +assert.sameValue(props({x:1}).length, 1); +assert.sameValue(props({x:1, y:2}).length, 2); + +assert(compareArray(props({x:1}), ["x"])); +assert(compareArray(props({x:1, y:2}), ["x", "y"])); +assert(compareArray(props({x:1, y:2, zoom:3}), ["x", "y", "zoom"])); diff --git a/test/language/block-scope/syntax/for-in/disallow-initialization-assignment.js b/test/language/block-scope/syntax/for-in/disallow-initialization-assignment.js new file mode 100644 index 0000000000..ebd348dc21 --- /dev/null +++ b/test/language/block-scope/syntax/for-in/disallow-initialization-assignment.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 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: > + for declaration: + disallow initialization assignment +negative: SyntaxError +---*/ +for (let x = 3 in {}) { } + diff --git a/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-and-without-initializer.js b/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-and-without-initializer.js new file mode 100644 index 0000000000..f1f23b0790 --- /dev/null +++ b/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-and-without-initializer.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 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: > + for declaration: + disallow multiple lexical bindings, with and without initializer +negative: SyntaxError +---*/ +for (let x = 3, y in {}) { } + diff --git a/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-initializer.js b/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-initializer.js new file mode 100644 index 0000000000..5f05dda555 --- /dev/null +++ b/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-initializer.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 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: > + for declaration: + disallow multiple lexical bindings, with initializer +negative: SyntaxError +---*/ +for (let x = 3, y = 4 in {}) { } + diff --git a/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-without-and-with-initializer.js b/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-without-and-with-initializer.js new file mode 100644 index 0000000000..0f77451a91 --- /dev/null +++ b/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-without-and-with-initializer.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 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: > + for declaration: + disallow multiple lexical bindings, without and with initializer +negative: SyntaxError +---*/ +for (let x, y = 4 in {}) { } + diff --git a/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings.js b/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings.js new file mode 100644 index 0000000000..14ac88f2c9 --- /dev/null +++ b/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 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: > + for declaration: + disallow multiple lexical bindings +negative: SyntaxError +---*/ +for (let x, y in {}) { } + diff --git a/test/language/block-scope/syntax/for-in/missing-identifier-let-disallowed-as-bound-name.js b/test/language/block-scope/syntax/for-in/missing-identifier-let-disallowed-as-bound-name.js new file mode 100644 index 0000000000..8c6f938b87 --- /dev/null +++ b/test/language/block-scope/syntax/for-in/missing-identifier-let-disallowed-as-bound-name.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 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: > + for declaration: + missing identifier, "let" disallowed as bound name +negative: SyntaxError +---*/ +for (let in {}) { } + diff --git a/test/language/block-scope/syntax/for-in/mixed-values-in-iteration.js b/test/language/block-scope/syntax/for-in/mixed-values-in-iteration.js new file mode 100644 index 0000000000..6fe9973346 --- /dev/null +++ b/test/language/block-scope/syntax/for-in/mixed-values-in-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) Copyright 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: > + Mixed values in iteration +---*/ +"use strict"; +function fn(x) { + let a = []; + for (let p in x) { + a.push(function () { return p; }); + } + let k = 0; + for (let q in x) { + assert.sameValue(q, a[k]()); + ++k; + } +} +fn({a : [0], b : 1, c : {v : 1}, get d() {}, set e(x) {}}); + diff --git a/test/language/block-scope/syntax/for-loop/const-invalid-assignment-next-expression.js b/test/language/block-scope/syntax/for-loop/const-invalid-assignment-next-expression.js new file mode 100644 index 0000000000..002697cd09 --- /dev/null +++ b/test/language/block-scope/syntax/for-loop/const-invalid-assignment-next-expression.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 2015 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + const: invalid assignment in next expression +negative: TypeError +---*/ + +for (const i = 0; i < 1; i++) { } diff --git a/test/language/block-scope/syntax/for-loop/const-outer-inner-let-bindings.js b/test/language/block-scope/syntax/for-loop/const-outer-inner-let-bindings.js new file mode 100644 index 0000000000..c821ee92dd --- /dev/null +++ b/test/language/block-scope/syntax/for-loop/const-outer-inner-let-bindings.js @@ -0,0 +1,22 @@ +// Copyright (C) Copyright 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 const binding unchanged by for-loop const binding +---*/ +// + +const x = "outer_x"; +const y = "outer_y"; +var i = 0; + +for (const x = "inner_x"; i < 1; i++) { + const y = "inner_y"; + + assert.sameValue(x, "inner_x"); + assert.sameValue(y, "inner_y"); +} +assert.sameValue(x, "outer_x"); +assert.sameValue(y, "outer_y"); + diff --git a/test/language/block-scope/syntax/for-loop/let-closure-inside-condition.js b/test/language/block-scope/syntax/for-loop/let-closure-inside-condition.js new file mode 100644 index 0000000000..3f24e5d776 --- /dev/null +++ b/test/language/block-scope/syntax/for-loop/let-closure-inside-condition.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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]()); +} diff --git a/test/language/block-scope/syntax/for-loop/let-closure-inside-initialization.js b/test/language/block-scope/syntax/for-loop/let-closure-inside-initialization.js new file mode 100644 index 0000000000..bc214fa53c --- /dev/null +++ b/test/language/block-scope/syntax/for-loop/let-closure-inside-initialization.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 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]()); +} diff --git a/test/language/block-scope/syntax/for-loop/let-closure-inside-next-expression.js b/test/language/block-scope/syntax/for-loop/let-closure-inside-next-expression.js new file mode 100644 index 0000000000..dceb519278 --- /dev/null +++ b/test/language/block-scope/syntax/for-loop/let-closure-inside-next-expression.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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]()); +} diff --git a/test/language/block-scope/syntax/for-loop/let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding.js b/test/language/block-scope/syntax/for-loop/let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding.js new file mode 100644 index 0000000000..cdb2878a73 --- /dev/null +++ b/test/language/block-scope/syntax/for-loop/let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding.js @@ -0,0 +1,16 @@ +// Copyright (C) Copyright 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]()); +} diff --git a/test/language/block-scope/syntax/for-loop/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding.js b/test/language/block-scope/syntax/for-loop/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding.js new file mode 100644 index 0000000000..4361dc2d90 --- /dev/null +++ b/test/language/block-scope/syntax/for-loop/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 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]()); +} diff --git a/test/language/block-scope/syntax/for-loop/let-outer-inner-let-bindings.js b/test/language/block-scope/syntax/for-loop/let-outer-inner-let-bindings.js new file mode 100644 index 0000000000..d8f50e2d31 --- /dev/null +++ b/test/language/block-scope/syntax/for-loop/let-outer-inner-let-bindings.js @@ -0,0 +1,21 @@ +// Copyright (C) Copyright 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"); + diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-case-expression-statement-list.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-case-expression-statement-list.js new file mode 100644 index 0000000000..679e1a1e31 --- /dev/null +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-case-expression-statement-list.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + function declarations in statement position in strict mode: + case Expression : StatementList +---*/ +switch (true) { case true: function g() {} } + diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-default-statement-list.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-default-statement-list.js new file mode 100644 index 0000000000..11d289f667 --- /dev/null +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-default-statement-list.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + function declarations in statement position in strict mode: + default : StatementList +---*/ +switch (true) { default: function g() {} } + diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-do-statement-while-expression.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-do-statement-while-expression.js new file mode 100644 index 0000000000..8f94a7f4d2 --- /dev/null +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-do-statement-while-expression.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: > + function declarations in statement position in strict mode: + do Statement while ( Expression ) +negative: SyntaxError +flags: [onlyStrict] +---*/ +do function g() {} while (false) + diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-for-statement.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-for-statement.js new file mode 100644 index 0000000000..325f757f1c --- /dev/null +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-for-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: > + function declarations in statement position in strict mode: + for ( ;;) Statement +negative: SyntaxError +flags: [onlyStrict] +---*/ +for (;false;) function g() {} + diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement-else-statement.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement-else-statement.js new file mode 100644 index 0000000000..b4a0531768 --- /dev/null +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement-else-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: > + function declarations in statement position in strict mode: + if ( Expression ) Statement else Statement +negative: SyntaxError +flags: [onlyStrict] +---*/ +if (true) {} else function g() {} + diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement.js new file mode 100644 index 0000000000..1eb4abd303 --- /dev/null +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: > + function declarations in statement position in strict mode: + if ( Expression ) Statement +negative: SyntaxError +flags: [onlyStrict] +---*/ +if (true) function g() {} + diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-label-statement.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-label-statement.js new file mode 100644 index 0000000000..32920ac699 --- /dev/null +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-label-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + function declarations in statement position in strict mode: + label: Statement +---*/ +label: function g() {} + diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-while-expression-statement.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-while-expression-statement.js new file mode 100644 index 0000000000..e772de8702 --- /dev/null +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-while-expression-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: > + function declarations in statement position in strict mode: + while ( Expression ) Statement +negative: SyntaxError +flags: [onlyStrict] +---*/ +while (false) function g() {} + diff --git a/test/language/block-scope/syntax/global-and-block/const.js b/test/language/block-scope/syntax/global-and-block/const.js new file mode 100644 index 0000000000..62a11ab4b1 --- /dev/null +++ b/test/language/block-scope/syntax/global-and-block/const.js @@ -0,0 +1,21 @@ +// Copyright (C) Copyright 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 const +---*/ +const z = 4; + +// Block local +{ + const z = 5; +} + +assert.sameValue(z, 4); + +if (true) { + const z = 1; + assert.sameValue(z, 1); +} + diff --git a/test/language/block-scope/syntax/global-and-block/let.js b/test/language/block-scope/syntax/global-and-block/let.js new file mode 100644 index 0000000000..e2a14600c3 --- /dev/null +++ b/test/language/block-scope/syntax/global-and-block/let.js @@ -0,0 +1,24 @@ +// Copyright (C) Copyright 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); +} + diff --git a/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-case-expression-statement-list.js b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-case-expression-statement-list.js new file mode 100644 index 0000000000..0b5159173a --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-case-expression-statement-list.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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; } + diff --git a/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-default-statement-list.js b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-default-statement-list.js new file mode 100644 index 0000000000..2fea96e2f4 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-default-statement-list.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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; } + diff --git a/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-do-statement-while-expression.js b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-do-statement-while-expression.js new file mode 100644 index 0000000000..6434bad8cd --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-do-statement-while-expression.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +do let x = 1; while (false) diff --git a/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-for-statement.js b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-for-statement.js new file mode 100644 index 0000000000..1a0b3d88c3 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-for-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +for (;false;) let x = 1; diff --git a/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-if-expression-statement-else-statement.js b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-if-expression-statement-else-statement.js new file mode 100644 index 0000000000..344afe73a3 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-if-expression-statement-else-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +if (true) {} else let x = 1; diff --git a/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-if-expression-statement.js b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-if-expression-statement.js new file mode 100644 index 0000000000..c4a8de6790 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-if-expression-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +if (true) let x = 1; diff --git a/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-label-statement.js b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-label-statement.js new file mode 100644 index 0000000000..24db93dd35 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-label-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +label: let x = 1; diff --git a/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-while-expression-statement.js b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-while-expression-statement.js new file mode 100644 index 0000000000..a12ae70920 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-while-expression-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +while (false) let x = 1; diff --git a/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-case-expression-statement-list.js b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-case-expression-statement-list.js new file mode 100644 index 0000000000..215e05b092 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-case-expression-statement-list.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 +negative: SyntaxError +---*/ +switch (true) { case true: let x; } diff --git a/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-default-statement-list.js b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-default-statement-list.js new file mode 100644 index 0000000000..bccfe824f9 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-default-statement-list.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 +negative: SyntaxError +---*/ +switch (true) { default: let x; } diff --git a/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-do-statement-while-expression.js b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-do-statement-while-expression.js new file mode 100644 index 0000000000..43dec6bb72 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-do-statement-while-expression.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +do let x; while (false) diff --git a/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-for-statement.js b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-for-statement.js new file mode 100644 index 0000000000..36398e4084 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-for-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +for (;false;) let x; diff --git a/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-if-expression-statement-else-statement.js b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-if-expression-statement-else-statement.js new file mode 100644 index 0000000000..2865f91586 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-if-expression-statement-else-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +if (true) {} else let x; diff --git a/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-if-expression-statement.js b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-if-expression-statement.js new file mode 100644 index 0000000000..9bd2e93d3b --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-if-expression-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +if (true) let x; diff --git a/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-label-statement.js b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-label-statement.js new file mode 100644 index 0000000000..6bfd0b18a2 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-label-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +label: let x; diff --git a/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-while-expression-statement.js b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-while-expression-statement.js new file mode 100644 index 0000000000..47ef3092fd --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-while-expression-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +while (false) let x; diff --git a/test/language/block-scope/syntax/redeclaration-global/allowed-to-declare-function-with-function-declaration.js b/test/language/block-scope/syntax/redeclaration-global/allowed-to-declare-function-with-function-declaration.js new file mode 100644 index 0000000000..431b17916e --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-global/allowed-to-declare-function-with-function-declaration.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + redeclaration outermost: + allowed to declare function with function declaration +---*/ +function f() {} + diff --git a/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-function-declaration-with-function-declaration.js b/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-function-declaration-with-function-declaration.js new file mode 100644 index 0000000000..c51e54cca1 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-function-declaration-with-function-declaration.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + redeclaration outermost: + allowed to redeclare function declaration with function declaration +---*/ +function f() {} function f() {} + diff --git a/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-function-declaration-with-var.js b/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-function-declaration-with-var.js new file mode 100644 index 0000000000..131b2c55e0 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-function-declaration-with-var.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + redeclaration outermost: + allowed to redeclare function declaration with var +---*/ +function f() {} var f; + diff --git a/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-var-with-function-declaration.js b/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-var-with-function-declaration.js new file mode 100644 index 0000000000..4d3e618566 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-var-with-function-declaration.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: > + redeclaration outermost: + allowed to redeclare var with function declaration +---*/ +var f; function f() {} + diff --git a/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js new file mode 100644 index 0000000000..e6020c6ec8 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: B.3.3 +description: > + redeclaration within block: + attempt to redeclare function declaration with function declaration +negative: SyntaxError +---*/ +{ function f() {} function f() {} } + diff --git a/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-let.js b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-let.js new file mode 100644 index 0000000000..d7341ab822 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-let.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: B.3.3 +description: > + redeclaration within block: + attempt to redeclare function declaration with let +negative: SyntaxError +---*/ +{ function f() {} let f; } diff --git a/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-var.js b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-var.js new file mode 100644 index 0000000000..fdd28f6b8d --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-var.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: B.3.3 +description: > + redeclaration within block: + attempt to redeclare function declaration with var +negative: SyntaxError +---*/ +{ function f() {} var f; } diff --git a/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-let-binding-with-function-declaration.js b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-let-binding-with-function-declaration.js new file mode 100644 index 0000000000..7c6cb7a9e4 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-let-binding-with-function-declaration.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: B.3.3 +description: > + redeclaration within block: + attempt to redeclare let binding with function declaration +negative: SyntaxError +---*/ +{ let f; function f() {} } diff --git a/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-let-binding-with-var.js b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-let-binding-with-var.js new file mode 100644 index 0000000000..1259da9bc4 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-let-binding-with-var.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: B.3.3 +description: > + redeclaration within block: + attempt to redeclare let binding with var +negative: SyntaxError +---*/ +{ let f; var f; } + diff --git a/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-var-binding-with-let.js b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-var-binding-with-let.js new file mode 100644 index 0000000000..6927a16933 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-var-binding-with-let.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: B.3.3 +description: > + redeclaration within block: + attempt to redeclare var binding with let +negative: SyntaxError +---*/ +{ var f; let f; } + diff --git a/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-var-with-function-declaration.js b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-var-with-function-declaration.js new file mode 100644 index 0000000000..4e374bf908 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-var-with-function-declaration.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: B.3.3 +description: > + redeclaration within block: + attempt to redeclare var with function declaration +negative: SyntaxError +---*/ +{ var f; function f() {} } +