From 55451e7b78c1765c6c3011d880c7980c10b7330f Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sun, 11 Oct 2020 18:18:57 +0100 Subject: support `const` (#4190) --- test/compress/conditionals.js | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'test/compress/conditionals.js') 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: { -- cgit v1.2.3 ef='/guix/log/THANKS?id=352602822375e3eccaf6b42a016a046f820f43a1'>Collapse)Author