aboutsummaryrefslogtreecommitdiff
path: root/test/compress/evaluate.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-09-17 16:08:36 +0100
committerGitHub <noreply@github.com>2020-09-17 23:08:36 +0800
commit72844eb5a4508d2e8fe43a4038983c382708d1e6 (patch)
tree6ea36193c9b9e60e48fa80f809235bcee6570cb8 /test/compress/evaluate.js
parent09d93cc6c80a934daae53dea6a13d96924a0f466 (diff)
downloadtracifyjs-72844eb5a4508d2e8fe43a4038983c382708d1e6.tar.gz
tracifyjs-72844eb5a4508d2e8fe43a4038983c382708d1e6.zip
improve fix for #4119 (#4121)
Diffstat (limited to 'test/compress/evaluate.js')
-rw-r--r--test/compress/evaluate.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js
index 5cf3fb1c..9504afb5 100644
--- a/test/compress/evaluate.js
+++ b/test/compress/evaluate.js
@@ -2960,3 +2960,57 @@ issue_4119_2: {
}
expect_stdout: "PASS"
}
+
+issue_4119_3: {
+ options = {
+ conditionals: true,
+ evaluate: true,
+ reduce_vars: true,
+ toplevel: true,
+ unsafe: true,
+ }
+ input: {
+ var a, b;
+ b = a = {
+ p: 42,
+ };
+ delete a.p;
+ console.log(b.p ? "FAIL" : "PASS");
+ }
+ expect: {
+ var a, b;
+ b = a = {
+ p: 42,
+ };
+ delete a.p;
+ console.log(b.p ? "FAIL" : "PASS");
+ }
+ expect_stdout: "PASS"
+}
+
+issue_4119_4: {
+ options = {
+ booleans: true,
+ conditionals: true,
+ evaluate: true,
+ reduce_vars: true,
+ toplevel: true,
+ }
+ input: {
+ var a, b;
+ b = a = {
+ p: 42,
+ };
+ delete a.p;
+ console.log(!b ? "FAIL" : "PASS");
+ }
+ expect: {
+ var a, b;
+ b = a = {
+ p: 42,
+ };
+ delete a.p;
+ console.log((b, 0, "PASS"));
+ }
+ expect_stdout: "PASS"
+}