aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-09-25 15:00:20 +0100
committerGitHub <noreply@github.com>2020-09-25 22:00:20 +0800
commit6e105c5ca6c95f6159d91f74df92020f33ae2f99 (patch)
treecd4e6ecffe3410808b7c419a8eadbda34d46cc46 /test/compress
parentaf35cd32f28dfc3f79380d8f1b8294fc550d07e2 (diff)
downloadtracifyjs-6e105c5ca6c95f6159d91f74df92020f33ae2f99.tar.gz
tracifyjs-6e105c5ca6c95f6159d91f74df92020f33ae2f99.zip
enhance `merge_vars` (#4152)
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/merge_vars.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/compress/merge_vars.js b/test/compress/merge_vars.js
index b5148669..b86b0e99 100644
--- a/test/compress/merge_vars.js
+++ b/test/compress/merge_vars.js
@@ -2800,3 +2800,25 @@ lambda_reuse: {
"string",
]
}
+
+conditional_write: {
+ options = {
+ merge_vars: true,
+ toplevel: true,
+ }
+ input: {
+ var a = "FAIL", b;
+ if (console)
+ a = "PASS";
+ b = [a, 42].join();
+ console.log(b);
+ }
+ expect: {
+ var b = "FAIL", b;
+ if (console)
+ b = "PASS";
+ b = [b, 42].join();
+ console.log(b);
+ }
+ expect_stdout: "PASS,42"
+}