From 6e105c5ca6c95f6159d91f74df92020f33ae2f99 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Fri, 25 Sep 2020 15:00:20 +0100 Subject: enhance `merge_vars` (#4152) --- test/compress/merge_vars.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test/compress') 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" +} -- cgit v1.2.3