diff options
Diffstat (limited to 'js/src/tests/test262/language/block-scope/leave')
17 files changed, 310 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/block-scope/leave/browser.js b/js/src/tests/test262/language/block-scope/leave/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/browser.js diff --git a/js/src/tests/test262/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-1.js b/js/src/tests/test262/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-1.js new file mode 100644 index 0000000000..71df11fcf4 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-1.js @@ -0,0 +1,20 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + 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) {} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-2.js b/js/src/tests/test262/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-2.js new file mode 100644 index 0000000000..39ddaaca24 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-2.js @@ -0,0 +1,23 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + 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'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-1.js b/js/src/tests/test262/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-1.js new file mode 100644 index 0000000000..67982b3ee2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-1.js @@ -0,0 +1,17 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + 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'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-2.js b/js/src/tests/test262/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-2.js new file mode 100644 index 0000000000..48af214652 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-2.js @@ -0,0 +1,20 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + 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'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-1.js b/js/src/tests/test262/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-1.js new file mode 100644 index 0000000000..59dc979b90 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-1.js @@ -0,0 +1,17 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + nested block let declaration only shadows outer parameter value 1 +---*/ +(function(x) { + label: { + let x = 'inner'; + break label; + } + assert.sameValue(x, 'outer'); +})('outer'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-2.js b/js/src/tests/test262/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-2.js new file mode 100644 index 0000000000..9a1829989a --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-2.js @@ -0,0 +1,20 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + 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'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/outermost-binding-updated-in-catch-block-nested-block-let-declaration-unseen-outside-of-block.js b/js/src/tests/test262/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..4a2dd81b07 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/outermost-binding-updated-in-catch-block-nested-block-let-declaration-unseen-outside-of-block.js @@ -0,0 +1,32 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + 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); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/shell.js b/js/src/tests/test262/language/block-scope/leave/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/shell.js diff --git a/js/src/tests/test262/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-1.js b/js/src/tests/test262/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-1.js new file mode 100644 index 0000000000..80a14d7677 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-1.js @@ -0,0 +1,18 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + 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'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-2.js b/js/src/tests/test262/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-2.js new file mode 100644 index 0000000000..7d0cb8c0f8 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-2.js @@ -0,0 +1,21 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + 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'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/verify-context-in-finally-block.js b/js/src/tests/test262/language/block-scope/leave/verify-context-in-finally-block.js new file mode 100644 index 0000000000..5bbfaaf087 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/verify-context-in-finally-block.js @@ -0,0 +1,22 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/verify-context-in-for-loop-block.js b/js/src/tests/test262/language/block-scope/leave/verify-context-in-for-loop-block.js new file mode 100644 index 0000000000..17590b18cb --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/verify-context-in-for-loop-block.js @@ -0,0 +1,20 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + 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'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/verify-context-in-labelled-block.js b/js/src/tests/test262/language/block-scope/leave/verify-context-in-labelled-block.js new file mode 100644 index 0000000000..32474daf50 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/verify-context-in-labelled-block.js @@ -0,0 +1,20 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + 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'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/verify-context-in-try-block.js b/js/src/tests/test262/language/block-scope/leave/verify-context-in-try-block.js new file mode 100644 index 0000000000..5b458d4a64 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/verify-context-in-try-block.js @@ -0,0 +1,21 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + verify context in try block 1 +---*/ +function f() {} + +(function(x) { + try { + let x = 'inner'; + throw 0; + } catch (e) { + f(); + assert.sameValue(x, 'outer'); + } +})('outer'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/x-after-break-to-label.js b/js/src/tests/test262/language/block-scope/leave/x-after-break-to-label.js new file mode 100644 index 0000000000..257e2441ac --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/x-after-break-to-label.js @@ -0,0 +1,19 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + x after break to label +---*/ +{ + let x = 2; + L: { + let x = 3; + assert.sameValue(x, 3); + break L; + assert(false); + } + assert.sameValue(x, 2); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/x-before-continue.js b/js/src/tests/test262/language/block-scope/leave/x-before-continue.js new file mode 100644 index 0000000000..b8114ec475 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/x-before-continue.js @@ -0,0 +1,20 @@ +// Copyright (C) 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + x before continue +---*/ +do { + let x = 4; + assert.sameValue(x, 4); + { + let x = 5; + assert.sameValue(x, 5); + continue; + assert(false); + } +} while (false); + + +reportCompare(0, 0); |