aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-19 12:28:38 +0800
committerGitHub <noreply@github.com>2020-12-19 12:28:38 +0800
commite6dd471f8fff84c878153008139150a090c5ba19 (patch)
treeec207ca4b7416a79b9abba17fdda35b44e5ef743 /test/compress
parent0f55bd92f18bd27628f1cfd10c9fb5d70f4d4d29 (diff)
downloadtracifyjs-e6dd471f8fff84c878153008139150a090c5ba19.tar.gz
tracifyjs-e6dd471f8fff84c878153008139150a090c5ba19.zip
support destructuring of `catch` variable (#4412)
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/destructured.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/compress/destructured.js b/test/compress/destructured.js
index 8e1cf68c..4c36e451 100644
--- a/test/compress/destructured.js
+++ b/test/compress/destructured.js
@@ -750,6 +750,46 @@ simple_var: {
node_version: ">=6"
}
+drop_catch: {
+ options = {
+ dead_code: true,
+ }
+ input: {
+ try {} catch ({
+ [console.log("FAIL")]: e,
+ }) {} finally {
+ console.log("PASS");
+ }
+ }
+ expect: {
+ console.log("PASS");
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
+drop_catch_var: {
+ options = {
+ unused: true,
+ }
+ input: {
+ try {
+ throw new Error("PASS");
+ } catch ({ name, message }) {
+ console.log(message);
+ }
+ }
+ expect: {
+ try {
+ throw new Error("PASS");
+ } catch ({ message }) {
+ console.log(message);
+ }
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
collapse_vars_1: {
options = {
collapse_vars: true,