diff options
Diffstat (limited to 'test/compress/numbers.js')
-rw-r--r-- | test/compress/numbers.js | 82 |
1 files changed, 80 insertions, 2 deletions
diff --git a/test/compress/numbers.js b/test/compress/numbers.js index 673ce23a..c432a435 100644 --- a/test/compress/numbers.js +++ b/test/compress/numbers.js @@ -91,7 +91,7 @@ evaluate_1: { expect: { console.log( x + 1 + 2, - 1 * x * 2, + 2 * x, +x + 1 + 2, 1 + x + 2 + 3, 3 | x, @@ -173,7 +173,7 @@ evaluate_2: { var x = "42", y = null; [ x + 1 + 2, - 1 * x * 2, + 2 * x, +x + 1 + 2, 1 + x + 2 + 3, 3 | x, @@ -979,3 +979,81 @@ unsafe_math_swap_constant: { } expect_stdout: "6 6 7 6 6 8 9 10" } + +identity_1: { + options = { + evaluate: true, + } + input: { + 0 + a; + a + 0; + 0 - a; + a - 0; + 1 * a; + a * 1; + 1 / a; + a / 1; + } + expect: { + 0 + a; + a + 0; + -a; + +a; + +a; + +a; + 1 / a; + +a; + } +} + +identity_2: { + options = { + evaluate: true, + } + input: { + 0 + !a; + !a + 0; + 0 - !a; + !a - 0; + 1 * !a; + !a * 1; + 1 / !a; + !a / 1; + } + expect: { + +!a; + +!a; + -!a; + +!a; + +!a; + +!a; + 1 / !a; + +!a; + } +} + +identity_3: { + options = { + evaluate: true, + } + input: { + 0 + --a; + --a + 0; + 0 - --a; + --a - 0; + 1 * --a; + --a * 1; + 1 / --a; + --a / 1; + } + expect: { + --a; + --a; + - --a; + --a; + --a; + --a; + 1 / --a; + --a; + } +} |