Bug 1185106 - Part 8.2: Add parser test for await in module. r=efaust,till draft
authorTooru Fujisawa <arai_a@mac.com>
Sun, 28 Aug 2016 23:58:29 +0900
changeset 430939 e16071e54650f45f59604ba085df4506a2135442
parent 430938 271d22945d6e0b98436e38c778a821bc3d8a7148
child 430940 f287af4c93ae1e45b3eaf1712d1cc9911cf2f7ff
push id33945
push userarai_a@mac.com
push dateFri, 28 Oct 2016 11:34:02 +0000
reviewersefaust, till
bugs1185106
milestone52.0a1
Bug 1185106 - Part 8.2: Add parser test for await in module. r=efaust,till MozReview-Commit-ID: JNEYt4Y3fo4
js/src/tests/ecma_7/AsyncFunctions/syntax-modules.js
new file mode 100644
--- /dev/null
+++ b/js/src/tests/ecma_7/AsyncFunctions/syntax-modules.js
@@ -0,0 +1,15 @@
+var BUGNUMBER = 1185106;
+var summary = "async/await syntax in module";
+
+print(BUGNUMBER + ": " + summary);
+
+if (asyncFunctionsEnabled() && typeof parseModule === "function") {
+    parseModule("async function f() { await 3; }");
+    parseModule("async function f() { await 3; }");
+    assertThrows(() => parseModule("var await = 5;"), SyntaxError);
+    assertThrows(() => parseModule("export var await;"), SyntaxError);
+    assertThrows(() => parseModule("async function f() { function g() { await 3; } }"), SyntaxError);
+}
+
+if (typeof reportCompare === "function")
+    reportCompare(true, true);