aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/compress/collapse_vars.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index cc6c5f9a..9fe5a93f 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -7308,3 +7308,40 @@ substitution_unary: {
"true 42 42",
]
}
+
+issue_3626_1: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ var a = "foo", b = 42;
+ a.p && (b = a) && a;
+ console.log(a, b);
+ }
+ expect: {
+ var a = "foo", b = 42;
+ a.p && (b = a) && a;
+ console.log(a, b);
+ }
+ expect_stdout: "foo 42"
+}
+
+issue_3626_2: {
+ options = {
+ collapse_vars: true,
+ conditionals: true,
+ }
+ input: {
+ var a = "foo", b = 42, c = null;
+ if (a && a.p)
+ if (b = a)
+ c++ + a;
+ console.log(a, b, c);
+ }
+ expect: {
+ var a = "foo", b = 42, c = null;
+ a && a.p && (b = a) && c++ + a;
+ console.log(a, b, c);
+ }
+ expect_stdout: "foo 42 null"
+}