summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-var-statement-captured.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/annexB/language/statements/try/catch-redeclared-var-statement-captured.js')
-rw-r--r--js/src/tests/test262/annexB/language/statements/try/catch-redeclared-var-statement-captured.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-var-statement-captured.js b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-var-statement-captured.js
new file mode 100644
index 0000000000..b9865d0a03
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-var-statement-captured.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 12.14-2
+es6id: B.3.5
+description: >
+ catch doesn't change declaration scope - var initializer in catch
+ with same name as catch parameter changes parameter
+---*/
+
+ function capturedFoo() {return foo};
+ foo = "prior to throw";
+ try {
+ throw new Error();
+ }
+ catch (foo) {
+ var foo = "initializer in catch";
+ }
+
+assert.sameValue(capturedFoo(), "prior to throw");
+
+reportCompare(0, 0);