diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-11-25 21:14:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-25 21:14:13 +0800 |
commit | 48a0f6fe411c09ed3250974332266ed2495832a9 (patch) | |
tree | 6907c7b2f13f020bac0f424f5ddf621c2ee7ce77 /test | |
parent | 81caadb70900654d309f4750d8d0fbfb8f97a99a (diff) | |
download | tracifyjs-48a0f6fe411c09ed3250974332266ed2495832a9.tar.gz tracifyjs-48a0f6fe411c09ed3250974332266ed2495832a9.zip |
enhance `unsafe_math` (#3603)
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/numbers.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/compress/numbers.js b/test/compress/numbers.js index 1203412a..673ce23a 100644 --- a/test/compress/numbers.js +++ b/test/compress/numbers.js @@ -945,3 +945,37 @@ issue_3593: { } expect_stdout: "-2" } + +unsafe_math_swap_constant: { + options = { + evaluate: true, + unsafe_math: true, + } + input: { + var a = 1, b = 2; + console.log( + a++ + b-- + 3, + a++ + b + 3, + a + b-- + 3, + a + b + 3, + a++ - b-- + 3, + a++ - b + 3, + a - b-- + 3, + a - b + 3 + ); + } + expect: { + var a = 1, b = 2; + console.log( + 3 + a++ + b--, + a++ + b + 3, + a + b-- + 3, + a + b + 3, + 3 + a++ - b--, + 3 + a++ - b, + a - b-- + 3, + a - b + 3 + ); + } + expect_stdout: "6 6 7 6 6 8 9 10" +} |