diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-10-11 18:18:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-12 01:18:57 +0800 |
commit | 55451e7b78c1765c6c3011d880c7980c10b7330f (patch) | |
tree | 8e63243cf2c73dd25867e2cb1ba3c8d7cf0ed1e9 /test/compress/conditionals.js | |
parent | ffcce28ce15afe9f0b8d8a4a83b901508eb866de (diff) | |
download | tracifyjs-55451e7b78c1765c6c3011d880c7980c10b7330f.tar.gz tracifyjs-55451e7b78c1765c6c3011d880c7980c10b7330f.zip |
support `const` (#4190)
Diffstat (limited to 'test/compress/conditionals.js')
-rw-r--r-- | test/compress/conditionals.js | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/test/compress/conditionals.js b/test/compress/conditionals.js index 5dfd17bc..8a4e3aad 100644 --- a/test/compress/conditionals.js +++ b/test/compress/conditionals.js @@ -55,14 +55,15 @@ ifs_3_should_warn: { } input: { var x, y; - if (x && !(x + "1") && y) { // 1 + // 1 + if (x && !(x + "1") && y) { var qq; foo(); } else { bar(); } - - if (x || !!(x + "1") || y) { // 2 + // 2 + if (x || !!(x + "1") || y) { foo(); } else { var jj; @@ -71,9 +72,27 @@ ifs_3_should_warn: { } expect: { var x, y; - var qq; bar(); // 1 - var jj; foo(); // 2 - } + // 1 + var qq; bar(); + // 2 + foo(); var jj; + } + expect_warnings: [ + "WARN: + in boolean context always true [test/compress/conditionals.js:3,18]", + "WARN: Boolean && always false [test/compress/conditionals.js:3,12]", + "WARN: Condition left of && always false [test/compress/conditionals.js:3,12]", + "WARN: Condition always false [test/compress/conditionals.js:3,12]", + "WARN: Dropping unreachable code [test/compress/conditionals.js:3,34]", + "WARN: Declarations in unreachable code! [test/compress/conditionals.js:4,12]", + "WARN: + in boolean context always true [test/compress/conditionals.js:10,19]", + "WARN: Boolean || always true [test/compress/conditionals.js:10,12]", + "WARN: Condition left of || always true [test/compress/conditionals.js:10,12]", + "WARN: Condition always true [test/compress/conditionals.js:10,12]", + "WARN: Dropping unreachable code [test/compress/conditionals.js:12,15]", + "WARN: Declarations in unreachable code! [test/compress/conditionals.js:13,12]", + "WARN: Dropping side-effect-free statement [test/compress/conditionals.js:3,12]", + "WARN: Dropping side-effect-free statement [test/compress/conditionals.js:10,12]", + ] } ifs_4: { |