diff options
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/exponentiation.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/compress/exponentiation.js b/test/compress/exponentiation.js new file mode 100644 index 00000000..008d5871 --- /dev/null +++ b/test/compress/exponentiation.js @@ -0,0 +1,58 @@ +precedence_1: { + input: { + console.log(-4 ** 3 ** 2); + } + expect_exact: "console.log((-4)**3**2);" + expect_stdout: "-262144" + node_version: ">=8" +} + +precedence_2: { + input: { + console.log(-4 ** (3 ** 2)); + } + expect_exact: "console.log((-4)**3**2);" + expect_stdout: "-262144" + node_version: ">=8" +} + +precedence_3: { + input: { + console.log(-(4 ** 3) ** 2); + } + expect_exact: "console.log((-(4**3))**2);" + expect_stdout: "4096" + node_version: ">=8" +} + +precedence_4: { + input: { + console.log((-4 ** 3) ** 2); + } + expect_exact: "console.log(((-4)**3)**2);" + expect_stdout: "4096" + node_version: ">=8" +} + +await: { + input: { + (async a => a * await a ** ++a % a)(2).then(console.log); + } + expect_exact: "(async a=>a*(await a)**++a%a)(2).then(console.log);" + expect_stdout: "1" + node_version: ">=8" +} + +evaluate: { + options = { + evaluate: true, + } + input: { + console.log(1 + 2 ** 3 - 4); + } + expect: { + console.log(5); + } + expect_stdout: "5" + node_version: ">=8" +} |