aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-09-18 14:35:29 +0100
committerGitHub <noreply@github.com>2020-09-18 21:35:29 +0800
commit38a46c86d7163002ad079eb9dd690e18b5c9da8f (patch)
tree9a1a4c1cfdd93c6aa577f53c6a143715fbb4707f /test
parent0f0759ec15d32673333b2397882a7f3e043d4cf9 (diff)
downloadtracifyjs-38a46c86d7163002ad079eb9dd690e18b5c9da8f.tar.gz
tracifyjs-38a46c86d7163002ad079eb9dd690e18b5c9da8f.zip
enhance `side_effects` (#4124)
- add documentation for `merge_vars`
Diffstat (limited to 'test')
-rw-r--r--test/compress/side_effects.js25
1 files changed, 25 insertions, 0 deletions
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,