diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-03-28 03:59:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-28 03:59:13 +0800 |
commit | 67d0237f73c3147855983edde137cd95a2cb1749 (patch) | |
tree | 88be1c764d2de5243ce210a5eef76382f511b7a2 /test/compress | |
parent | 984a21704e126616a74d65a1e8790aeccd02f548 (diff) | |
download | tracifyjs-67d0237f73c3147855983edde137cd95a2cb1749.tar.gz tracifyjs-67d0237f73c3147855983edde137cd95a2cb1749.zip |
fix tail trimming of switch blocks (#1707)
now guarded under `dead_code`
fixes #1705
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/switch.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/test/compress/switch.js b/test/compress/switch.js index 9f9d3568..5c12449c 100644 --- a/test/compress/switch.js +++ b/test/compress/switch.js @@ -614,3 +614,69 @@ issue_1698: { } expect_stdout: "2" } + +issue_1705_1: { + options = { + dead_code: true, + } + input: { + var a = 0; + switch (a) { + default: + console.log("FAIL"); + case 0: + break; + } + } + expect: { + var a = 0; + switch (a) { + default: + console.log("FAIL"); + case 0: + } + } + expect_stdout: true +} + +issue_1705_2: { + options = { + dead_code: true, + evaluate: true, + reduce_vars: true, + sequences: true, + side_effects: true, + toplevel: true, + unused: true, + } + input: { + var a = 0; + switch (a) { + default: + console.log("FAIL"); + case 0: + break; + } + } + expect: { + } + expect_stdout: true +} + +issue_1705_3: { + options = { + dead_code: true, + } + input: { + switch (a) { + case 0: + break; + default: + break; + } + } + expect: { + a; + } + expect_stdout: true +} |