aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-05-28 03:53:10 +0100
committerGitHub <noreply@github.com>2021-05-28 10:53:10 +0800
commitd320a6cde2ef6436874f4f3790c790d65ed0c966 (patch)
treee23d8cfd36a8fa57c0ee196d622eea9adc1d121f /test/compress
parent8cd95dd2635189b27d1956796d917549e2179bf5 (diff)
downloadtracifyjs-d320a6cde2ef6436874f4f3790c790d65ed0c966.tar.gz
tracifyjs-d320a6cde2ef6436874f4f3790c790d65ed0c966.zip
fix corner case in `awaits` (#4973)
fixes #4972
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/awaits.js108
1 files changed, 108 insertions, 0 deletions
diff --git a/test/compress/awaits.js b/test/compress/awaits.js
index d5b60789..e1b2805c 100644
--- a/test/compress/awaits.js
+++ b/test/compress/awaits.js
@@ -1574,3 +1574,111 @@ issue_4764_3: {
expect_stdout: "PASS"
node_version: ">=8"
}
+
+issue_4972_1: {
+ options = {
+ awaits: true,
+ side_effects: true,
+ }
+ input: {
+ console.log("foo");
+ (async function() {
+ try {
+ return await "bar";
+ } finally {
+ console.log("baz");
+ }
+ })().then(console.log);
+ console.log("moo");
+ }
+ expect: {
+ console.log("foo");
+ (async function() {
+ try {
+ return await "bar";
+ } finally {
+ console.log("baz");
+ }
+ })().then(console.log);
+ console.log("moo");
+ }
+ expect_stdout: [
+ "foo",
+ "moo",
+ "baz",
+ "bar",
+ ]
+ node_version: ">=8"
+}
+
+issue_4972_2: {
+ options = {
+ awaits: true,
+ side_effects: true,
+ }
+ input: {
+ console.log("foo");
+ (async function() {
+ try {
+ console.log("bar");
+ } finally {
+ return await "baz";
+ }
+ })().then(console.log);
+ console.log("moo");
+ }
+ expect: {
+ console.log("foo");
+ (async function() {
+ try {
+ console.log("bar");
+ } finally {
+ return "baz";
+ }
+ })().then(console.log);
+ console.log("moo");
+ }
+ expect_stdout: [
+ "foo",
+ "bar",
+ "moo",
+ "baz",
+ ]
+ node_version: ">=8"
+}
+
+issue_4972_3: {
+ options = {
+ awaits: true,
+ side_effects: true,
+ }
+ input: {
+ console.log("foo");
+ try {
+ (async function() {
+ return await "bar";
+ })().then(console.log);
+ } finally {
+ console.log("baz");
+ }
+ console.log("moo");
+ }
+ expect: {
+ console.log("foo");
+ try {
+ (async function() {
+ return "bar";
+ })().then(console.log);
+ } finally {
+ console.log("baz");
+ }
+ console.log("moo");
+ }
+ expect_stdout: [
+ "foo",
+ "baz",
+ "moo",
+ "bar",
+ ]
+ node_version: ">=8"
+}