aboutsummaryrefslogtreecommitdiff
path: root/test/compress/default-values.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-24 09:02:18 +0000
committerGitHub <noreply@github.com>2020-12-24 17:02:18 +0800
commit18966945324786d29def134662221a068297161d (patch)
tree9cd23edc4262ff7ab0d8b32a9b315a9788abc56d /test/compress/default-values.js
parent5f269cd57356fc4dbe7486dca22902d22695d499 (diff)
downloadtracifyjs-18966945324786d29def134662221a068297161d.tar.gz
tracifyjs-18966945324786d29def134662221a068297161d.zip
fix & enhance `collapse_vars` (#4447)
fixes #4446
Diffstat (limited to 'test/compress/default-values.js')
-rw-r--r--test/compress/default-values.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/compress/default-values.js b/test/compress/default-values.js
index 64dad3cf..8b9b3a95 100644
--- a/test/compress/default-values.js
+++ b/test/compress/default-values.js
@@ -974,3 +974,41 @@ issue_4444: {
expect_stdout: "PASS"
node_version: ">=6"
}
+
+issue_4446_1: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ a = 42;
+ [ b = 42 ] = [ "PASS" ];
+ c = 42;
+ console.log(b, a);
+ }
+ expect: {
+ [ b = 42 ] = [ "PASS" ];
+ c = a = 42;
+ console.log(b, a);
+ }
+ expect_stdout: "PASS 42"
+ node_version: ">=6"
+}
+
+issue_4446_2: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ a = 42;
+ var [ b = 42 ] = [ "PASS" ];
+ c = 42;
+ console.log(b, a);
+ }
+ expect: {
+ var [ b = 42 ] = [ "PASS" ];
+ c = a = 42;
+ console.log(b, a);
+ }
+ expect_stdout: "PASS 42"
+ node_version: ">=6"
+}