aboutsummaryrefslogtreecommitdiff
path: root/test/compress/evaluate.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-10-10 09:37:02 +0800
committerGitHub <noreply@github.com>2019-10-10 09:37:02 +0800
commit33c94d3bd90af2ceaa3faf36cdf19c2dd8700619 (patch)
treebcffafb1f07c09ec229b7fe48e0e009f80b4907f /test/compress/evaluate.js
parentb18f717b46d655aa183d09109e1e6cbbc4462c04 (diff)
downloadtracifyjs-33c94d3bd90af2ceaa3faf36cdf19c2dd8700619.tar.gz
tracifyjs-33c94d3bd90af2ceaa3faf36cdf19c2dd8700619.zip
detect boolean context across IIFEs (#3461)
Diffstat (limited to 'test/compress/evaluate.js')
-rw-r--r--test/compress/evaluate.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js
index 0ac117fe..22c87b70 100644
--- a/test/compress/evaluate.js
+++ b/test/compress/evaluate.js
@@ -1757,3 +1757,34 @@ issue_3387_2: {
}
expect_stdout: "NaN"
}
+
+iife_boolean_context: {
+ options = {
+ booleans: true,
+ evaluate: true,
+ }
+ input: {
+ console.log(function() {
+ return Object(1) || false;
+ }() ? "PASS" : "FAIL");
+ console.log(function() {
+ return [].length || true;
+ }() ? "PASS" : "FAIL");
+ }
+ expect: {
+ console.log(function() {
+ return Object(1);
+ }() ? "PASS" : "FAIL");
+ console.log(function() {
+ return [].length, 1;
+ }() ? "PASS" : "FAIL");
+ }
+ expect_stdout: [
+ "PASS",
+ "PASS",
+ ]
+ expect_warnings: [
+ "WARN: Dropping side-effect-free || [test/compress/evaluate.js:2,19]",
+ "WARN: Boolean || always true [test/compress/evaluate.js:5,19]",
+ ]
+}