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/arrow-function-at-end-of-for-statement-head.js64
-rw-r--r--js/src/tests/ecma_6/Statements/arrow-function-in-for-statement-head.js33
-rw-r--r--js/src/tests/ecma_6/Statements/browser.js0
-rw-r--r--js/src/tests/ecma_6/Statements/for-in-with-declaration.js31
-rw-r--r--js/src/tests/ecma_6/Statements/for-in-with-destructuring-assignments.js130
-rw-r--r--js/src/tests/ecma_6/Statements/for-inof-coverinitname-destr-assign.js55
-rw-r--r--js/src/tests/ecma_6/Statements/for-inof-loop-const-declaration.js94
-rw-r--r--js/src/tests/ecma_6/Statements/for-inof-name-iteration-expression-contains-index-string.js43
-rw-r--r--js/src/tests/ecma_6/Statements/for-loop-declaration-contains-computed-name.js48
-rw-r--r--js/src/tests/ecma_6/Statements/for-loop-declaration-contains-initializer.js50
-rw-r--r--js/src/tests/ecma_6/Statements/for-of-iterator-primitive.js28
-rw-r--r--js/src/tests/ecma_6/Statements/for-of-var-with-initializer.js32
-rw-r--r--js/src/tests/ecma_6/Statements/if-constant-folding.js35
-rw-r--r--js/src/tests/ecma_6/Statements/property-reference-self-assignment.js38
-rw-r--r--js/src/tests/ecma_6/Statements/shell.js0
-rw-r--r--js/src/tests/ecma_6/Statements/try-completion.js482
16 files changed, 1163 insertions, 0 deletions
diff --git a/js/src/tests/ecma_6/Statements/arrow-function-at-end-of-for-statement-head.js b/js/src/tests/ecma_6/Statements/arrow-function-at-end-of-for-statement-head.js
new file mode 100644
index 000000000..9043b818c
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/arrow-function-at-end-of-for-statement-head.js
@@ -0,0 +1,64 @@
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+//-----------------------------------------------------------------------------
+var gTestfile = "arrow-function-in-for-statement-head.js";
+var BUGNUMBER = 1302994;
+var summary =
+ "Don't assert when an arrow function occurs at the end of a declaration " +
+ "init-component of a for(;;) loop head";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+function f1()
+{
+ for (var x = a => b; false; false)
+ {}
+}
+f1();
+
+function f2()
+{
+ for (var x = a => b, y = c => d; false; false)
+ {}
+}
+f2();
+
+function f3()
+{
+ for (var x = a => {}; false; false)
+ {}
+}
+f3();
+
+function f4()
+{
+ for (var x = a => {}, y = b => {}; false; false)
+ {}
+}
+f4();
+
+function g1()
+{
+ for (a => b; false; false)
+ {}
+}
+g1();
+
+function g2()
+{
+ for (a => {}; false; false)
+ {}
+}
+g2();
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete");
diff --git a/js/src/tests/ecma_6/Statements/arrow-function-in-for-statement-head.js b/js/src/tests/ecma_6/Statements/arrow-function-in-for-statement-head.js
new file mode 100644
index 000000000..4b636d3ac
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/arrow-function-in-for-statement-head.js
@@ -0,0 +1,33 @@
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+//-----------------------------------------------------------------------------
+var gTestfile = "arrow-function-in-for-statement-head.js";
+var BUGNUMBER = 1163851;
+var summary =
+ "|for (x => 0 in 1;;) break;| must be a syntax error per ES6, not an " +
+ "elaborate nop";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+try
+{
+ Function("for (x => 0 in 1;;) break;");
+ throw new Error("didn't throw");
+}
+catch (e)
+{
+ assertEq(e instanceof SyntaxError, true,
+ "expected syntax error, got " + e);
+}
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete");
diff --git a/js/src/tests/ecma_6/Statements/browser.js b/js/src/tests/ecma_6/Statements/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/browser.js
diff --git a/js/src/tests/ecma_6/Statements/for-in-with-declaration.js b/js/src/tests/ecma_6/Statements/for-in-with-declaration.js
new file mode 100644
index 000000000..13c71b19c
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/for-in-with-declaration.js
@@ -0,0 +1,31 @@
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+//-----------------------------------------------------------------------------
+var gTestfile = "for-in-with-declaration.js";
+var BUGNUMBER = 1163851;
+var summary =
+ "Declarations in for-in loop heads must not contain |in|-expression " +
+ "initializers";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+assertThrowsInstanceOf(() => Function("for (var x = 3 in {}; ; ) break;"), SyntaxError);
+assertThrowsInstanceOf(() => Function("for (var x, y = 3 in {}; ; ) break;"), SyntaxError);
+assertThrowsInstanceOf(() => Function("for (var x = 5, y = 3 in {}; ; ) break;"), SyntaxError);
+assertThrowsInstanceOf(() => Function("for (const x = 3 in {}; ; ) break;"), SyntaxError);
+assertThrowsInstanceOf(() => Function("for (const x = 5, y = 3 in {}; ; ) break;"), SyntaxError);
+assertThrowsInstanceOf(() => Function("for (let x = 3 in {}; ; ) break;"), SyntaxError);
+assertThrowsInstanceOf(() => Function("for (let x, y = 3 in {}; ; ) break;"), SyntaxError);
+assertThrowsInstanceOf(() => Function("for (let x = 2, y = 3 in {}; ; ) break;"), SyntaxError);
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete");
diff --git a/js/src/tests/ecma_6/Statements/for-in-with-destructuring-assignments.js b/js/src/tests/ecma_6/Statements/for-in-with-destructuring-assignments.js
new file mode 100644
index 000000000..6741c885e
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/for-in-with-destructuring-assignments.js
@@ -0,0 +1,130 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var gTestfile = "for-in-with-destructuring-assignments.js";
+var BUGNUMBER = 1164741;
+var summary = "|for (var <pat> = ... in ...)| is invalid syntax";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+// This is a total grab-bag of junk originally in tests changed when this
+// syntax was removed. Avert your eyes!
+
+assertThrowsInstanceOf(() => eval(`
+ for (var [x] = x>>x in [[]<[]])
+ {
+ [];
+ }`),
+ SyntaxError);
+
+/******************************************************************************/
+
+assertThrowsInstanceOf(function() {
+ // Abandon all hope, ye who try to read this.
+ eval(`
+ (function () {
+ for
+ (var [x] = function(){}
+ in
+ (function m(a) {
+ if (a < 1) {
+ x;
+ return;
+ }
+ return m(a - 1) + m(a - 2);
+ })(7)(eval(""))
+ )
+ {
+ [];
+ }
+ })
+ `)();
+}, SyntaxError);
+
+/******************************************************************************/
+
+assertThrowsInstanceOf(() => eval(`
+ for (var [e] = [] in (eval("for (b = 0; b < 6; ++b) gc()"))) {}
+`), SyntaxError);
+
+/******************************************************************************/
+
+assertThrowsInstanceOf(() => eval("for (var [ v , c ] = 0 in undefined) { }"),
+ SyntaxError);
+
+/******************************************************************************/
+
+assertThrowsInstanceOf(() => eval("var b = e; for (var [e] = b in w) c"),
+ SyntaxError);
+
+/******************************************************************************/
+
+assertThrowsInstanceOf(() => eval("for (var {a: []} = 2 in []) { }"),
+ SyntaxError);
+
+/******************************************************************************/
+
+assertThrowsInstanceOf(() => eval(`try
+ {
+ for (var [,{y}] = 1 in []) {}
+ }
+ catch(ex)
+ {
+ }`),
+SyntaxError);
+
+/******************************************************************************/
+
+assertThrowsInstanceOf(() => eval("for (var [x] = [] in null);"),
+ SyntaxError);
+
+/******************************************************************************/
+
+assertThrowsInstanceOf(() => eval("for (var [x] = x in y) var x;"),
+ SyntaxError);
+
+/******************************************************************************/
+
+assertThrowsInstanceOf(() => eval(`
+ for (var [arguments] = ({ get y(){} }) in y ) (x);
+`),
+SyntaxError);
+
+/******************************************************************************/
+
+if (typeof evalcx == 'function') {
+ var src = 'try {\n' +
+ ' for (var [e] = /x/ in d) {\n' +
+ ' (function () {});\n' +
+ ' }\n' +
+ '} catch (e) {}\n' +
+ 'try {\n' +
+ ' let(x = Object.freeze(this, /x/))\n' +
+ ' e = {}.toString\n' +
+ ' function y() {}\n' +
+ '} catch (e) {}';
+
+ try
+ {
+ evalcx(src);
+ throw new Error("didn't throw");
+ }
+ catch (e)
+ {
+ assertEq(e.name === "SyntaxError", true,
+ "expected invalid syntax, got " + e);
+ }
+}
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete");
diff --git a/js/src/tests/ecma_6/Statements/for-inof-coverinitname-destr-assign.js b/js/src/tests/ecma_6/Statements/for-inof-coverinitname-destr-assign.js
new file mode 100644
index 000000000..ba9e40959
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/for-inof-coverinitname-destr-assign.js
@@ -0,0 +1,55 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+const defaultValue = "default-value";
+const unreachable = () => { throw "unreachable"; };
+
+// for-in statement, object destructuring.
+var forIn;
+for ({forIn = defaultValue} in {"": null});
+assertEq(forIn, defaultValue);
+
+forIn = undefined;
+String.prototype.forIn = defaultValue;
+for ({forIn = unreachable()} in {"": null});
+delete String.prototype.forIn;
+assertEq(forIn, defaultValue);
+
+// for-in statement, array destructuring.
+forIn = undefined;
+for ([forIn = defaultValue] in {"": null});
+assertEq(forIn, defaultValue);
+
+forIn = undefined;
+for ([forIn = unreachable()] in {"ABC": null});
+assertEq(forIn, "A");
+
+
+// for-of statement, object destructuring.
+var forOf;
+for ({forOf = defaultValue} of [{}]);
+assertEq(forOf, defaultValue);
+
+forOf = undefined;
+for ({forOf = unreachable()} of [{forOf: defaultValue}]);
+assertEq(forOf, defaultValue);
+
+// for-of statement, array destructuring.
+forOf = undefined;
+for ([forOf = defaultValue] of [[]]);
+assertEq(forOf, defaultValue);
+
+forOf = undefined;
+for ([forOf = unreachable()] of [[defaultValue]]);
+assertEq(forOf, defaultValue);
+
+
+// for-statement, object destructuring.
+assertThrowsInstanceOf(() => eval(`
+ for ({invalid = 0};;);
+`), SyntaxError);
+
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/ecma_6/Statements/for-inof-loop-const-declaration.js b/js/src/tests/ecma_6/Statements/for-inof-loop-const-declaration.js
new file mode 100644
index 000000000..e8daa343b
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/for-inof-loop-const-declaration.js
@@ -0,0 +1,94 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var gTestfile = "for-inof-loop-const-declaration.js";
+var BUGNUMBER = 1278150;
+var summary = "Support const declarations in for-of loop heads";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var count;
+
+count = 0;
+for (const x in "abcdef")
+{
+ assertEq(x, "" + count++);
+
+ try
+ {
+ x = 3;
+ throw new Error("didn't throw");
+ }
+ catch (e)
+ {
+ assertEq(e instanceof TypeError, true,
+ "didn't get a TypeError, instead got: " + e);
+ }
+}
+
+count = 0;
+for (const x of "012345")
+{
+ assertEq(x, "" + count++);
+
+ try
+ {
+ x = 3;
+ throw new Error("didn't throw");
+ }
+ catch (e)
+ {
+ assertEq(e instanceof TypeError, true,
+ "didn't get a TypeError, instead got: " + e);
+ }
+}
+
+count = 0;
+for (const { length, 0: c } in "abcdef")
+{
+ assertEq(length, 1);
+ assertEq(c, "" + count++);
+
+
+ try
+ {
+ length = 1;
+ throw new Error("didn't throw");
+ }
+ catch (e)
+ {
+ assertEq(e instanceof TypeError, true,
+ "didn't get a TypeError, instead got: " + e);
+ }
+}
+
+count = 0;
+for (const { length, 0: c } of "012345")
+{
+ assertEq(length, 1);
+ assertEq(c, "" + count++);
+
+ try
+ {
+ c = 42;
+ throw new Error("didn't throw");
+ }
+ catch (e)
+ {
+ assertEq(e instanceof TypeError, true,
+ "didn't get a TypeError, instead got: " + e);
+ }
+}
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete");
diff --git a/js/src/tests/ecma_6/Statements/for-inof-name-iteration-expression-contains-index-string.js b/js/src/tests/ecma_6/Statements/for-inof-name-iteration-expression-contains-index-string.js
new file mode 100644
index 000000000..212b34db9
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/for-inof-name-iteration-expression-contains-index-string.js
@@ -0,0 +1,43 @@
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+//-----------------------------------------------------------------------------
+var gTestfile = "for-inof-name-iteration-expression-contains-index-string.js";
+var BUGNUMBER = 1235640;
+var summary =
+ "Don't assert parsing a for-in/of loop whose target is a name, where the " +
+ "expression being iterated over contains a string containing an index";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+function f()
+{
+ var x;
+ for (x in "9")
+ continue;
+ assertEq(x, "0");
+}
+
+f();
+
+function g()
+{
+ "use strict";
+ var x = "unset";
+ for (x in arguments)
+ continue;
+ assertEq(x, "unset");
+}
+
+g();
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete");
diff --git a/js/src/tests/ecma_6/Statements/for-loop-declaration-contains-computed-name.js b/js/src/tests/ecma_6/Statements/for-loop-declaration-contains-computed-name.js
new file mode 100644
index 000000000..7928d049d
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/for-loop-declaration-contains-computed-name.js
@@ -0,0 +1,48 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var gTestfile = "for-loop-declaration-contains-computed-name.js";
+var BUGNUMBER = 1233767;
+var summary =
+ "Support computed property names in destructuring declarations in " +
+ "for-in/of loop heads";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var count;
+
+count = 0;
+for (var { [5]: x, [x]: y } of [{ 5: 42, 42: "hi" }, { 5: 17, 17: 'fnord' }])
+{
+ if (count === 0) {
+ assertEq(x, 42);
+ assertEq(y, "hi");
+ } else {
+ assertEq(x, 17);
+ assertEq(y, "fnord");
+ }
+
+ count++;
+}
+
+count = 0;
+for (var { length: x, [x - 1]: y } in "foo")
+{
+ assertEq(x, 1);
+ assertEq("" + count, y);
+
+ count++;
+}
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete");
diff --git a/js/src/tests/ecma_6/Statements/for-loop-declaration-contains-initializer.js b/js/src/tests/ecma_6/Statements/for-loop-declaration-contains-initializer.js
new file mode 100644
index 000000000..7010c9eba
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/for-loop-declaration-contains-initializer.js
@@ -0,0 +1,50 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var gTestfile = "for-loop-declaration-contains-computed-name.js";
+var BUGNUMBER = 1233767;
+var summary =
+ "Support initializer defaults in destructuring declarations in for-in/of " +
+ "loop heads";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var count;
+var expr;
+
+expr = [{ z: 42, 42: "hi" }, { 7: 'fnord' }];
+count = 0;
+for (var { z: x = 7, [x]: y = 3 } of expr)
+{
+ if (count === 0) {
+ assertEq(x, 42);
+ assertEq(y, "hi");
+ } else {
+ assertEq(x, 7);
+ assertEq(y, "fnord");
+ }
+
+ count++;
+}
+
+count = 0;
+for (var { length: x, [x - 1 + count]: y = "psych" } in "foo")
+{
+ assertEq(x, 1);
+ assertEq(y, count === 0 ? "0" : "psych");
+
+ count++;
+}
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete");
diff --git a/js/src/tests/ecma_6/Statements/for-of-iterator-primitive.js b/js/src/tests/ecma_6/Statements/for-of-iterator-primitive.js
new file mode 100644
index 000000000..6d69a1282
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/for-of-iterator-primitive.js
@@ -0,0 +1,28 @@
+var BUGNUMBER = 1021835;
+var summary = "Returning non-object from @@iterator should throw";
+
+print(BUGNUMBER + ": " + summary);
+
+let primitives = [
+ 1,
+ true,
+ undefined,
+ null,
+ "foo",
+ Symbol.iterator
+];
+
+for (let primitive of primitives) {
+ let obj = {
+ [Symbol.iterator]() {
+ return primitive;
+ }
+ };
+ assertThrowsInstanceOf(() => {
+ for (let x of obj) {
+ }
+ }, TypeError);
+}
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Statements/for-of-var-with-initializer.js b/js/src/tests/ecma_6/Statements/for-of-var-with-initializer.js
new file mode 100644
index 000000000..ae42e153b
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/for-of-var-with-initializer.js
@@ -0,0 +1,32 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+var gTestfile = "for-of-var-with-initializer.js";
+var BUGNUMBER = 1164741;
+var summary = "Don't assert parsing |for (var x = 3 of 42);|";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+try
+{
+ Function("for (var x = 3 of 42);");
+ throw new Error("didn't throw");
+}
+catch (e)
+{
+ assertEq(e instanceof SyntaxError, true,
+ "expected syntax error, got: " + e);
+}
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete");
diff --git a/js/src/tests/ecma_6/Statements/if-constant-folding.js b/js/src/tests/ecma_6/Statements/if-constant-folding.js
new file mode 100644
index 000000000..0486ad56f
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/if-constant-folding.js
@@ -0,0 +1,35 @@
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+//-----------------------------------------------------------------------------
+var gTestfile = "if-constant-folding.js";
+var BUGNUMBER = 1183400;
+var summary =
+ "Don't crash constant-folding an |if| governed by a truthy constant, whose " +
+ "alternative statement is another |if|";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+// Perform |if| constant folding correctly when the condition is constantly
+// truthy and the alternative statement is another |if|.
+if (true)
+{
+ assertEq(true, true, "sanity");
+}
+else if (42)
+{
+ assertEq(false, true, "not reached");
+ assertEq(true, false, "also not reached");
+}
+
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
+
+print("Tests complete");
diff --git a/js/src/tests/ecma_6/Statements/property-reference-self-assignment.js b/js/src/tests/ecma_6/Statements/property-reference-self-assignment.js
new file mode 100644
index 000000000..81c95b9cf
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/property-reference-self-assignment.js
@@ -0,0 +1,38 @@
+var hits = 0;
+
+var p = { toString() { hits++; return "prop" } };
+var obj = { foo: 1 };
+
+
+var ops = [["obj[p]++", 2],
+ ["++obj[p]", 2],
+ ["--obj[p]", 0],
+ ["obj[p]--", 0],
+ ["obj[p] += 2", 3],
+ ["obj[p] -= 2", -1],
+ ["obj[p] *= 2", 2],
+ ["obj[p] /= 2", 0.5],
+ ["obj[p] %= 2", 1],
+ ["obj[p] >>>= 2", 0],
+ ["obj[p] >>= 2", 0],
+ ["obj[p] <<= 2", 4],
+ ["obj[p] |= 2", 3],
+ ["obj[p] ^= 2", 3],
+ ["obj[p] &= 2", 0]];
+
+var testHits = 0;
+for (let op of ops) {
+ // Seed the value for each test.
+ obj.prop = 1;
+
+ // Do the operation.
+ eval(op[0]);
+ assertEq(obj.prop, op[1]);
+
+ // We should always call toString once, for each operation.
+ testHits++;
+ assertEq(hits, testHits);
+}
+
+if (typeof reportCompare === 'function')
+ reportCompare(0,0,"OK");
diff --git a/js/src/tests/ecma_6/Statements/shell.js b/js/src/tests/ecma_6/Statements/shell.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/shell.js
diff --git a/js/src/tests/ecma_6/Statements/try-completion.js b/js/src/tests/ecma_6/Statements/try-completion.js
new file mode 100644
index 000000000..f9bd1e149
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/try-completion.js
@@ -0,0 +1,482 @@
+var BUGNUMBER = 819125;
+var summary = "try block should return try value if finally returned normally";
+
+print(BUGNUMBER + ": " + summary);
+
+function expectTryValue(code, isUndefined) {
+ assertEq(eval(code), isUndefined ? undefined : 'try');
+}
+
+function expectCatchValue(code, isUndefined) {
+ assertEq(eval(code), isUndefined ? undefined : 'catch');
+}
+
+function expectFinallyValue(code, isUndefined) {
+ assertEq(eval(code), isUndefined ? undefined : 'finally');
+}
+
+// ==== finally: normal ====
+
+// try: normal
+// finally: normal
+expectTryValue(`
+try {
+ 'try';
+} finally {
+ 'finally';
+}
+`);
+
+// try: normal without value
+// finally: normal
+expectTryValue(`
+try {
+} finally {
+ 'finally';
+}
+`, true);
+
+// try: break
+// finally: normal
+expectTryValue(`
+while (true) {
+ try {
+ 'try';
+ break;
+ } finally {
+ 'finally';
+ }
+}
+`);
+
+// try: break without value
+// finally: normal
+expectTryValue(`
+while (true) {
+ try {
+ break;
+ } finally {
+ 'finally';
+ }
+}
+`, true);
+
+// try: continue
+// finally: normal
+expectTryValue(`
+do {
+ try {
+ 'try';
+ continue;
+ } finally {
+ 'finally';
+ }
+} while (false);
+`);
+
+// try: continue without value
+// finally: normal
+expectTryValue(`
+do {
+ try {
+ continue;
+ } finally {
+ 'finally';
+ }
+} while (false);
+`, true);
+
+// try: throw
+// catch: normal
+// finally: normal
+expectCatchValue(`
+try {
+ 'try';
+ throw 'exception';
+} catch (e) {
+ 'catch';
+} finally {
+ 'finally';
+}
+`);
+
+// try: throw
+// catch: normal
+// finally: normal
+expectCatchValue(`
+try {
+ 'try';
+ throw 'exception';
+} catch (e) {
+ 'catch';
+} finally {
+ 'finally';
+}
+`);
+
+// try: throw
+// catch: normal without value
+// finally: normal
+expectCatchValue(`
+try {
+ 'try';
+ throw 'exception';
+} catch (e) {
+} finally {
+ 'finally';
+}
+`, true);
+
+// try: throw
+// catch: normal without value
+// finally: normal
+expectCatchValue(`
+try {
+ 'try';
+ throw 'exception';
+} catch (e) {
+} finally {
+ 'finally';
+}
+`, true);
+
+// try: throw
+// catch: break
+// finally: normal
+expectCatchValue(`
+while (true) {
+ try {
+ 'try';
+ throw 'exception';
+ } catch (e) {
+ 'catch';
+ break;
+ } finally {
+ 'finally';
+ }
+}
+`);
+
+// try: throw
+// catch: break without value
+// finally: normal
+expectCatchValue(`
+while (true) {
+ try {
+ 'try';
+ throw 'exception';
+ } catch (e) {
+ break;
+ } finally {
+ 'finally';
+ }
+}
+`, true);
+
+// try: throw
+// catch: continue
+// finally: normal
+expectCatchValue(`
+do {
+ try {
+ 'try';
+ throw 'exception';
+ } catch (e) {
+ 'catch';
+ continue;
+ } finally {
+ 'finally';
+ }
+} while (false);
+`);
+
+// try: throw
+// catch: continue without value
+// finally: normal
+expectCatchValue(`
+do {
+ try {
+ 'try';
+ throw 'exception';
+ } catch (e) {
+ continue;
+ } finally {
+ 'finally';
+ }
+} while (false);
+`, true);
+
+// ==== finally: break ====
+
+// try: normal
+// finally: break
+expectFinallyValue(`
+while (true) {
+ try {
+ 'try';
+ } finally {
+ 'finally';
+ break;
+ }
+}
+`);
+
+// try: normal
+// finally: break without value
+expectFinallyValue(`
+while (true) {
+ try {
+ 'try';
+ } finally {
+ break;
+ }
+}
+`, true);
+
+// try: break
+// finally: break
+expectFinallyValue(`
+while (true) {
+ try {
+ 'try';
+ break;
+ } finally {
+ 'finally';
+ break;
+ }
+}
+`);
+
+// try: break
+// finally: break without value
+expectFinallyValue(`
+while (true) {
+ try {
+ 'try';
+ break;
+ } finally {
+ break;
+ }
+}
+`, true);
+
+// try: continue
+// finally: break
+expectFinallyValue(`
+do {
+ try {
+ 'try';
+ continue;
+ } finally {
+ 'finally';
+ break;
+ }
+} while (false);
+`);
+
+// try: continue
+// finally: break without value
+expectFinallyValue(`
+do {
+ try {
+ 'try';
+ continue;
+ } finally {
+ break;
+ }
+} while (false);
+`, true);
+
+// try: throw
+// catch: normal
+// finally: break
+expectFinallyValue(`
+while (true) {
+ try {
+ 'try';
+ throw 'exception';
+ } catch (e) {
+ 'catch';
+ } finally {
+ 'finally';
+ break;
+ }
+}
+`, false);
+
+// try: throw
+// catch: normal
+// finally: break without value
+expectFinallyValue(`
+while (true) {
+ try {
+ 'try';
+ throw 'exception';
+ } catch (e) {
+ 'catch';
+ } finally {
+ break;
+ }
+}
+`, true);
+
+// ==== finally: continue ====
+
+// try: normal
+// finally: continue
+expectFinallyValue(`
+do {
+ try {
+ 'try';
+ } finally {
+ 'finally';
+ continue;
+ }
+} while (false);
+`);
+
+// try: normal
+// finally: continue without value
+expectFinallyValue(`
+do {
+ try {
+ 'try';
+ } finally {
+ continue;
+ }
+} while (false);
+`, true);
+
+// try: break
+// finally: continue
+expectFinallyValue(`
+do {
+ try {
+ 'try';
+ break;
+ } finally {
+ 'finally';
+ continue;
+ }
+} while (false);
+`);
+
+// try: break
+// finally: continue without value
+expectFinallyValue(`
+do {
+ try {
+ 'try';
+ break;
+ } finally {
+ continue;
+ }
+} while (false);
+`, true);
+
+// try: continue
+// finally: continue
+expectFinallyValue(`
+do {
+ try {
+ 'try';
+ continue;
+ } finally {
+ 'finally';
+ continue;
+ }
+} while (false);
+`);
+
+// try: continue
+// finally: continue without value
+expectFinallyValue(`
+do {
+ try {
+ 'try';
+ continue;
+ } finally {
+ continue;
+ }
+} while (false);
+`, true);
+
+// ==== without finally ====
+
+// try: throw
+// catch: normal
+expectCatchValue(`
+try {
+ 'try';
+ throw 'exception';
+} catch (e) {
+ 'catch';
+}
+`);
+
+// try: throw
+// catch: normal without value
+expectCatchValue(`
+try {
+ 'try';
+ throw 'exception';
+} catch (e) {
+}
+`, true);
+
+// try: throw
+// catch: break
+expectCatchValue(`
+while (true) {
+ try {
+ 'try';
+ throw 'exception';
+ } catch (e) {
+ 'catch';
+ break;
+ }
+}
+`);
+
+// try: throw
+// catch: break without value
+expectCatchValue(`
+while (true) {
+ try {
+ 'try';
+ throw 'exception';
+ } catch (e) {
+ break;
+ }
+}
+`, true);
+
+// try: throw
+// catch: continue
+expectCatchValue(`
+do {
+ try {
+ 'try';
+ throw 'exception';
+ } catch (e) {
+ 'catch';
+ continue;
+ }
+} while (false);
+`);
+
+// try: throw
+// catch: continue without value
+expectCatchValue(`
+do {
+ try {
+ 'try';
+ throw 'exception';
+ } catch (e) {
+ continue;
+ }
+} while (false);
+`, true);
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);