aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-02-22 15:59:28 +0000
committerGitHub <noreply@github.com>2021-02-22 23:59:28 +0800
commite535f1918915251681df6ffe80a56d56672685ea (patch)
tree23a331f65e2b2d1265005331167928519d3e127b /test/compress
parentf9a2a9d78e8437d8b9591e97ab280e20b9442b35 (diff)
downloadtracifyjs-e535f1918915251681df6ffe80a56d56672685ea.tar.gz
tracifyjs-e535f1918915251681df6ffe80a56d56672685ea.zip
fix corner case in `templates` (#4677)
fixes #4676
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/templates.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/compress/templates.js b/test/compress/templates.js
index 8ea4d396..d9e95975 100644
--- a/test/compress/templates.js
+++ b/test/compress/templates.js
@@ -298,3 +298,33 @@ issue_4630: {
expect_stdout: "/PASS/"
node_version: ">=4"
}
+
+issue_4676: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ templates: true,
+ toplevel: true,
+ unsafe:true,
+ unused: true,
+ }
+ input: {
+ function f(a) {
+ var b = `foo${a = "PASS"}`;
+ for (var c in f && b)
+ b.p;
+ return a;
+ }
+ console.log(f("FAIL"));
+ }
+ expect: {
+ console.log(function f(a) {
+ var b = "fooPASS";
+ for (var c in f, b)
+ b.p;
+ return "PASS";
+ }());
+ }
+ expect_stdout: "PASS"
+ node_version: ">=4"
+}