aboutsummaryrefslogtreecommitdiff
path: root/test/compress/global_defs.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-07-19 18:14:36 +0800
committerGitHub <noreply@github.com>2018-07-19 18:14:36 +0800
commit7cf72b8d66ea3a504648f42a2142728d520f3141 (patch)
tree3b447024096a4ca42de87b9306bd6b2edbfcf62a /test/compress/global_defs.js
parentcea685f8d98ad198f3a99d8a217183d15650959d (diff)
downloadtracifyjs-7cf72b8d66ea3a504648f42a2142728d520f3141.tar.gz
tracifyjs-7cf72b8d66ea3a504648f42a2142728d520f3141.zip
fix corner case in `global_defs` (#3218)
fixes #3217
Diffstat (limited to 'test/compress/global_defs.js')
-rw-r--r--test/compress/global_defs.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/compress/global_defs.js b/test/compress/global_defs.js
index 98fa3e9f..f1ef81d9 100644
--- a/test/compress/global_defs.js
+++ b/test/compress/global_defs.js
@@ -142,7 +142,6 @@ mixed: {
}
expect_warnings: [
"WARN: global_defs CONFIG.VALUE redefined [test/compress/global_defs.js:4,22]",
- "WARN: global_defs CONFIG.VALUE redefined [test/compress/global_defs.js:5,22]",
"WARN: global_defs CONFIG.VALUE redefined [test/compress/global_defs.js:7,8]",
]
}
@@ -197,3 +196,23 @@ issue_2167: {
doWork();
}
}
+
+issue_3217: {
+ options = {
+ collapse_vars: true,
+ global_defs: {
+ "@o": "{fn:function(){var a=42;console.log(a)}}",
+ },
+ inline: true,
+ properties: true,
+ reduce_vars: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ o.fn();
+ }
+ expect: {
+ console.log(42);
+ }
+}