aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/compress/awaits.js24
-rw-r--r--test/reduce.js5
-rw-r--r--test/ufuzz/index.js7
3 files changed, 32 insertions, 4 deletions
diff --git a/test/compress/awaits.js b/test/compress/awaits.js
index 7ae753fb..8caa60c0 100644
--- a/test/compress/awaits.js
+++ b/test/compress/awaits.js
@@ -1,3 +1,27 @@
+async_arrow: {
+ input: {
+ (async a => console.log(a))("PASS");
+ console.log(typeof (async () => 42)());
+ }
+ expect_exact: '(async a=>console.log(a))("PASS");console.log(typeof(async()=>42)());'
+ expect_stdout: [
+ "PASS",
+ "object",
+ ]
+ node_version: ">=8"
+}
+
+async_label: {
+ input: {
+ (async function() {
+ async: console.log("PASS");
+ })();
+ }
+ expect_exact: '(async function(){async:console.log("PASS")})();'
+ expect_stdout: "PASS"
+ node_version: ">=8"
+}
+
await_await: {
input: {
(async function() {
diff --git a/test/reduce.js b/test/reduce.js
index cd00d5e9..3f24b7b4 100644
--- a/test/reduce.js
+++ b/test/reduce.js
@@ -667,7 +667,10 @@ function is_timed_out(result) {
function is_statement(node) {
return node instanceof U.AST_Statement
- && !(node instanceof U.AST_Arrow || node instanceof U.AST_AsyncFunction || node instanceof U.AST_Function);
+ && !(node instanceof U.AST_Arrow
+ || node instanceof U.AST_AsyncArrow
+ || node instanceof U.AST_AsyncFunction
+ || node instanceof U.AST_Function);
}
function merge_sequence(array, node) {
diff --git a/test/ufuzz/index.js b/test/ufuzz/index.js
index 7f2a7d72..edb98aa7 100644
--- a/test/ufuzz/index.js
+++ b/test/ufuzz/index.js
@@ -1053,7 +1053,7 @@ function _createExpression(recurmax, noComma, stmtDepth, canThrow) {
var s = [];
switch (rng(5)) {
case 0:
- if (SUPPORT.arrow && !async && !name && rng(2)) {
+ if (SUPPORT.arrow && !name && rng(2)) {
var args, suffix;
(rng(2) ? createBlockVariables : function() {
arguments[3]();
@@ -1067,16 +1067,17 @@ function _createExpression(recurmax, noComma, stmtDepth, canThrow) {
} else {
params = createParams(save_async, NO_DUPLICATE);
}
+ params = (async ? "async (" : "(") + params + ") => ";
if (defns) {
s.push(
- "((" + params + ") => {",
+ "(" + params + "{",
strictMode(),
defns(),
_createStatements(rng(5) + 1, recurmax, canThrow, CANNOT_BREAK, CANNOT_CONTINUE, CAN_RETURN, stmtDepth)
);
suffix = "})";
} else {
- s.push("((" + params + ") => ");
+ s.push("(" + params);
switch (rng(10)) {
case 0:
s.push('(typeof arguments != "undefined" && arguments && arguments[' + rng(3) + "])");