diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-12-01 14:32:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-01 14:32:00 +0800 |
commit | 7ac6fdcc9923e173522c4b94b919ac09049024f9 (patch) | |
tree | 0e926ef1b019f8dae6735bfb6ae20c0b4b398d03 /test/compress | |
parent | f6610baaa8c5c6acf8f4a52babf68d0439aead1f (diff) | |
download | tracifyjs-7ac6fdcc9923e173522c4b94b919ac09049024f9.tar.gz tracifyjs-7ac6fdcc9923e173522c4b94b919ac09049024f9.zip |
improve switch case compression (#2547)
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/issue-1750.js | 4 | ||||
-rw-r--r-- | test/compress/switch.js | 27 |
2 files changed, 29 insertions, 2 deletions
diff --git a/test/compress/issue-1750.js b/test/compress/issue-1750.js index d18bc49f..970cea12 100644 --- a/test/compress/issue-1750.js +++ b/test/compress/issue-1750.js @@ -7,7 +7,7 @@ case_1: { input: { var a = 0, b = 1; switch (true) { - case a, true: + case a || true: default: b = 2; case true: @@ -17,7 +17,7 @@ case_1: { expect: { var a = 0, b = 1; switch (true) { - case a, true: + case a || true: b = 2; } console.log(a, b); diff --git a/test/compress/switch.js b/test/compress/switch.js index b763d741..fbb86eda 100644 --- a/test/compress/switch.js +++ b/test/compress/switch.js @@ -833,7 +833,34 @@ issue_2535: { } expect: { w(), 42; + 42; y(); z(); } } + +issue_1750: { + options = { + dead_code: true, + evaluate: true, + switches: true, + } + input: { + var a = 0, b = 1; + switch (true) { + case a, true: + default: + b = 2; + case true: + } + console.log(a, b); + } + expect: { + var a = 0, b = 1; + true; + a, true; + b = 2; + console.log(a, b); + } + expect_stdout: "0 2" +} |