From 23b51287aa31630c5454fecb5991fd18f7528366 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Tue, 2 Mar 2021 09:33:28 +0000 Subject: fix corner case in `evaluate` (#4716) fixes #4715 --- test/compress/exponentiation.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'test') 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" +} -- cgit v1.2.3