aboutsummaryrefslogtreecommitdiff
path: root/test/compress/dead-code.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress/dead-code.js')
-rw-r--r--test/compress/dead-code.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/compress/dead-code.js b/test/compress/dead-code.js
index 7772e76e..bb72451c 100644
--- a/test/compress/dead-code.js
+++ b/test/compress/dead-code.js
@@ -214,3 +214,45 @@ dead_code_const_annotation_complex_scope: {
}
expect_stdout: true
}
+
+try_catch_finally: {
+ options = {
+ conditionals: true,
+ dead_code: true,
+ evaluate: true,
+ }
+ input: {
+ var a = 1;
+ !function() {
+ try {
+ if (false) throw x;
+ } catch (a) {
+ var a = 2;
+ console.log("FAIL");
+ } finally {
+ a = 3;
+ console.log("PASS");
+ }
+ }();
+ try {
+ console.log(a);
+ } finally {
+ }
+ }
+ expect: {
+ var a = 1;
+ !function() {
+ var a;
+ a = 3;
+ console.log("PASS");
+ }();
+ try {
+ console.log(a);
+ } finally {
+ }
+ }
+ expect_stdout: [
+ "PASS",
+ "1",
+ ]
+}