summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_6/Statements
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/ecma_6/Statements')
-rw-r--r--js/src/tests/ecma_6/Statements/for-inof-finally.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/js/src/tests/ecma_6/Statements/for-inof-finally.js b/js/src/tests/ecma_6/Statements/for-inof-finally.js
new file mode 100644
index 000000000..187dcdaf5
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/for-inof-finally.js
@@ -0,0 +1,54 @@
+var BUGNUMBER = 1332881;
+var summary =
+ "Leaving for-in and try should handle stack value in correct order";
+
+print(BUGNUMBER + ": " + summary);
+
+var a = (function () {
+ for (var x in [0]) {
+ try {} finally {
+ return 11;
+ }
+ }
+})();
+assertEq(a, 11);
+
+var b = (function () {
+ for (var x of [0]) {
+ try {} finally {
+ return 12;
+ }
+ }
+})();
+assertEq(b, 12);
+
+var c = (function () {
+ for (var x in [0]) {
+ for (var y of [0]) {
+ try {} finally {
+ return 13;
+ }
+ }
+ }
+})();
+assertEq(c, 13);
+
+var d = (function () {
+ for (var x in [0]) {
+ for (var y of [0]) {
+ try {} finally {
+ for (var z in [0]) {
+ for (var w of [0]) {
+ try {} finally {
+ return 14;
+ }
+ }
+ }
+ }
+ }
+ }
+})();
+assertEq(d, 14);
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);