diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-12-29 02:50:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-29 02:50:57 +0000 |
commit | af310ba2d0cd79fbc02d29db2d959367c276b2b9 (patch) | |
tree | 96d55232c11f9304250fe6ad08a367a46baa72a1 /test | |
parent | 2f3930d1b92746be6a3b3e1d371b0ae25e56777e (diff) | |
download | tracifyjs-af310ba2d0cd79fbc02d29db2d959367c276b2b9.tar.gz tracifyjs-af310ba2d0cd79fbc02d29db2d959367c276b2b9.zip |
fix corner case in `evaluate` (#3654)
fixes #3653
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/numbers.js | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/test/compress/numbers.js b/test/compress/numbers.js index c432a435..07e93f60 100644 --- a/test/compress/numbers.js +++ b/test/compress/numbers.js @@ -997,7 +997,7 @@ identity_1: { expect: { 0 + a; a + 0; - -a; + 0 - a; +a; +a; +a; @@ -1023,7 +1023,7 @@ identity_2: { expect: { +!a; +!a; - -!a; + 0 - !a; +!a; +!a; +!a; @@ -1049,7 +1049,7 @@ identity_3: { expect: { --a; --a; - - --a; + 0 - --a; --a; --a; --a; @@ -1057,3 +1057,42 @@ identity_3: { --a; } } + +issue_3653: { + options = { + evaluate: true, + } + input: { + console.log(0 - (console && 0)); + console.log(0 + (0 - (console && 0))); + console.log(0 - (0 - (console && 0))); + console.log(1 * (0 - (console && 0))); + console.log(1 / (0 - (console && 0))); + console.log((0 - (console && 0)) + 0); + console.log((0 - (console && 0)) - 0); + console.log((0 - (console && 0)) * 1); + console.log((0 - (console && 0)) / 1); + } + expect: { + console.log(0 - (console && 0)); + console.log(0 - (console && 0)); + console.log(0 - (0 - (console && 0))); + console.log(0 - (console && 0)); + console.log(1 / (0 - (console && 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", + ] +} |