From 38a46c86d7163002ad079eb9dd690e18b5c9da8f Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Fri, 18 Sep 2020 14:35:29 +0100 Subject: enhance `side_effects` (#4124) - add documentation for `merge_vars` --- test/compress/side_effects.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test') diff --git a/test/compress/side_effects.js b/test/compress/side_effects.js index 244e3881..0746a56d 100644 --- a/test/compress/side_effects.js +++ b/test/compress/side_effects.js @@ -245,6 +245,31 @@ unsafe_builtin_2: { expect_stdout: "object PASS PASS" } +unsafe_builtin_3: { + options = { + conditionals: true, + side_effects: true, + toplevel: true, + unsafe: true, + } + input: { + var o = {}; + if (42 < Math.random()) + o.p = "FAIL"; + else + o.p = "PASS"; + for (var k in o) + console.log(k, o[k]); + } + expect: { + var o = {}; + o.p = 42 < Math.random() ? "FAIL" : "PASS"; + for (var k in o) + console.log(k, o[k]); + } + expect_stdout: "p PASS" +} + unsafe_string_replace: { options = { side_effects: true, -- cgit v1.2.3