aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-04-02 17:07:20 +0800
committerGitHub <noreply@github.com>2017-04-02 17:07:20 +0800
commit9469c03ac976b3cfc1e52abf034ce76f1d6aca59 (patch)
tree05d5d5df8658191e2da841f01142e9279f73224d /test/compress
parentd57527697fba37bfad50ca0283326a458cdea031 (diff)
downloadtracifyjs-9469c03ac976b3cfc1e52abf034ce76f1d6aca59.tar.gz
tracifyjs-9469c03ac976b3cfc1e52abf034ce76f1d6aca59.zip
fix corner case in `switch` (#1765)
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/issue-1750.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/compress/issue-1750.js b/test/compress/issue-1750.js
index c1448afe..d18bc49f 100644
--- a/test/compress/issue-1750.js
+++ b/test/compress/issue-1750.js
@@ -24,3 +24,31 @@ case_1: {
}
expect_stdout: "0 2"
}
+
+case_2: {
+ options = {
+ dead_code: true,
+ evaluate: true,
+ switches: true,
+ }
+ input: {
+ var a = 0, b = 1;
+ switch (0) {
+ default:
+ b = 2;
+ case a:
+ a = 3;
+ case 0:
+ }
+ console.log(a, b);
+ }
+ expect: {
+ var a = 0, b = 1;
+ switch (0) {
+ case a:
+ a = 3;
+ }
+ console.log(a, b);
+ }
+ expect_stdout: "3 1"
+}