diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-12-29 21:16:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-29 21:16:53 +0800 |
commit | 78c8efd851411a3605f667e78efaa342a1c65b53 (patch) | |
tree | 02e6eecee7f46f5ef884a7567add990d9c286002 /test/compress | |
parent | af310ba2d0cd79fbc02d29db2d959367c276b2b9 (diff) | |
download | tracifyjs-78c8efd851411a3605f667e78efaa342a1c65b53.tar.gz tracifyjs-78c8efd851411a3605f667e78efaa342a1c65b53.zip |
fix corner case in `evaluate` (#3656)
fixes #3655
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/numbers.js | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/test/compress/numbers.js b/test/compress/numbers.js index 07e93f60..f49996a4 100644 --- a/test/compress/numbers.js +++ b/test/compress/numbers.js @@ -1075,14 +1075,53 @@ issue_3653: { } expect: { console.log(0 - (console && 0)); - console.log(0 - (console && 0)); + console.log(0 - (console && 0) + 0); console.log(0 - (0 - (console && 0))); console.log(0 - (console && 0)); console.log(1 / (0 - (console && 0))); + console.log(0 - (console && 0) + 0); console.log(0 - (console && 0)); console.log(0 - (console && 0)); console.log(0 - (console && 0)); - console.log(0 - (console && 0)); + } + expect_stdout: [ + "0", + "0", + "0", + "0", + "Infinity", + "0", + "0", + "0", + "0", + ] +} + +issue_3655: { + options = { + evaluate: true, + } + input: { + console.log(0 + 0 * -[].length); + console.log(0 + (0 + 0 * -[].length)); + console.log(0 - (0 + 0 * -[].length)); + console.log(1 * (0 + 0 * -[].length)); + console.log(1 / (0 + 0 * -[].length)); + console.log((0 + 0 * -[].length) + 0); + console.log((0 + 0 * -[].length) - 0); + console.log((0 + 0 * -[].length) * 1); + console.log((0 + 0 * -[].length) / 1); + } + expect: { + console.log(0 + 0 * -[].length); + console.log(0 + 0 * -[].length); + console.log(0 - (0 + 0 * -[].length)); + console.log(0 + 0 * -[].length); + console.log(1 / (0 + 0 * -[].length)); + console.log(0 + 0 * -[].length); + console.log(0 + 0 * -[].length); + console.log(0 + 0 * -[].length); + console.log(0 + 0 * -[].length); } expect_stdout: [ "0", |