aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-12-02 02:26:56 +0800
committerGitHub <noreply@github.com>2017-12-02 02:26:56 +0800
commit85c56adbd19bff5e7bc2a59dd937799b7bc5a8d4 (patch)
tree60d28bbd31c57273d904dbee73db72c83273efa4 /test/compress
parent8da3754e51140c0eee80f02fcf3f5d99a74ca86e (diff)
downloadtracifyjs-85c56adbd19bff5e7bc2a59dd937799b7bc5a8d4.tar.gz
tracifyjs-85c56adbd19bff5e7bc2a59dd937799b7bc5a8d4.zip
more tests for #2535 (#2551)
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/evaluate.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js
index 8e030d22..6106fce3 100644
--- a/test/compress/evaluate.js
+++ b/test/compress/evaluate.js
@@ -1306,3 +1306,37 @@ issue_2535_2: {
x();
}
}
+
+issue_2535_3: {
+ options = {
+ booleans: true,
+ evaluate: true,
+ }
+ input: {
+ console.log(Object(1) && 1 && 2);
+ console.log(Object(1) && true && 1 && 2 && Object(2));
+ console.log(Object(1) && true && 1 && null && 2 && Object(2));
+ console.log(2 == Object(1) || 0 || void 0 || null);
+ console.log(2 == Object(1) || 0 || void 0 || null || Object(2));
+ console.log(2 == Object(1) || 0 || void 0 || "ok" || null || Object(2));
+ }
+ expect: {
+ console.log(Object(1) && 2);
+ console.log(Object(1) && Object(2));
+ console.log(Object(1) && null);
+ console.log(2 == Object(1) || null);
+ console.log(2 == Object(1) || Object(2));
+ console.log(2 == Object(1) || "ok");
+ }
+ expect_stdout: true
+ expect_warnings: [
+ "WARN: Dropping side-effect-free && [test/compress/evaluate.js:1316,20]",
+ "WARN: Dropping side-effect-free && [test/compress/evaluate.js:1317,20]",
+ "WARN: Dropping side-effect-free && [test/compress/evaluate.js:1318,20]",
+ "WARN: Condition left of && always false [test/compress/evaluate.js:1318,20]",
+ "WARN: Dropping side-effect-free || [test/compress/evaluate.js:1319,20]",
+ "WARN: Dropping side-effect-free || [test/compress/evaluate.js:1320,20]",
+ "WARN: Dropping side-effect-free || [test/compress/evaluate.js:1321,20]",
+ "WARN: Condition left of || always true [test/compress/evaluate.js:1321,20]",
+ ]
+}