summaryrefslogtreecommitdiff
path: root/js/src/tests
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-06-08 13:34:41 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:14 -0400
commitf319f49a5280a7ba37cb551a7236505e496ae34a (patch)
tree6992d5f1e1522f1953169b1b84f193c081e2d8e9 /js/src/tests
parentdcb43bda93f1f2cbe3da5ba1b7d3f783f1c8ad1c (diff)
downloaduxp-f319f49a5280a7ba37cb551a7236505e496ae34a.tar.gz
1317153 - Provide better error message when errornous syntax possibly match "await SOMETHING" outside async function.
Diffstat (limited to 'js/src/tests')
-rw-r--r--js/src/tests/ecma_2017/AsyncFunctions/await-error.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/js/src/tests/ecma_2017/AsyncFunctions/await-error.js b/js/src/tests/ecma_2017/AsyncFunctions/await-error.js
new file mode 100644
index 0000000000..1f40ea8a0b
--- /dev/null
+++ b/js/src/tests/ecma_2017/AsyncFunctions/await-error.js
@@ -0,0 +1,16 @@
+var BUGNUMBER = 1317153;
+var summary = "await outside of async function should provide better error";
+
+print(BUGNUMBER + ": " + summary);
+
+let caught = false;
+try {
+ eval("await 10");
+} catch(e) {
+ assertEq(e.message, "await is only valid in async functions");
+ caught = true;
+}
+assertEq(caught, true);
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);