From f319f49a5280a7ba37cb551a7236505e496ae34a Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sat, 8 Jun 2019 13:34:41 -0400 Subject: 1317153 - Provide better error message when errornous syntax possibly match "await SOMETHING" outside async function. --- js/src/tests/ecma_2017/AsyncFunctions/await-error.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 js/src/tests/ecma_2017/AsyncFunctions/await-error.js (limited to 'js/src/tests') 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); -- cgit v1.2.3