diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-03-02 09:33:28 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-02 17:33:28 +0800 |
commit | 23b51287aa31630c5454fecb5991fd18f7528366 (patch) | |
tree | 7d03497d5b40bc5274dcdbd71cf62d4647e7d0e2 /test | |
parent | 74dee5c445b1424866ef78ac9b06c507ef92959c (diff) | |
download | tracifyjs-23b51287aa31630c5454fecb5991fd18f7528366.tar.gz tracifyjs-23b51287aa31630c5454fecb5991fd18f7528366.zip |
fix corner case in `evaluate` (#4716)
fixes #4715
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/exponentiation.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/compress/exponentiation.js b/test/compress/exponentiation.js index b6cfde51..5de3c964 100644 --- a/test/compress/exponentiation.js +++ b/test/compress/exponentiation.js @@ -84,3 +84,42 @@ issue_4664: { expect_stdout: "function 1073741824 object" node_version: ">=8" } + +issue_4715: { + options = { + evaluate: true, + } + input: { + A = 1; + console.log((-0) ** A + 0); + console.log((-0) ** A - 0); + console.log((-0) ** A * 1); + console.log((-0) ** A / 1); + console.log(Math.pow(-0, A) + 0); + console.log(Math.pow(-0, A) - 0); + console.log(Math.pow(-0, A) * 1); + console.log(Math.pow(-0, A) / 1); + } + expect: { + A = 1; + console.log((-0) ** A + 0); + console.log((-0) ** A); + console.log((-0) ** A * 1); + console.log((-0) ** A); + console.log(Math.pow(-0, A) + 0); + console.log(+Math.pow(-0, A)); + console.log(+Math.pow(-0, A)); + console.log(+Math.pow(-0, A)); + } + expect_stdout: [ + "0", + "-0", + "-0", + "-0", + "0", + "-0", + "-0", + "-0", + ] + node_version: ">=8" +} |