aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/collapse_vars.js4
-rw-r--r--test/compress/default-values.js38
-rw-r--r--test/compress/destructured.js18
3 files changed, 58 insertions, 2 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index 17ee8d10..f630883a 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -4273,8 +4273,8 @@ issue_2436_14: {
var b = {};
(function() {
a && function(c, d) {
- console.log(c, d);
- }(b, a);
+ console.log(b, d);
+ }(0, a);
})();
}
expect_stdout: true
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"
+}
diff --git a/test/compress/destructured.js b/test/compress/destructured.js
index 5594658d..7fe2f0c8 100644
--- a/test/compress/destructured.js
+++ b/test/compress/destructured.js
@@ -2146,3 +2146,21 @@ issue_4436_undefined: {
expect_stdout: true
node_version: ">=6"
}
+
+issue_4446: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ a = "PASS";
+ var a = [ a[0] ] = [ a ];
+ console.log(a[0]);
+ }
+ expect: {
+ a = "PASS";
+ var a = [ a[0] ] = [ a ];
+ console.log(a[0]);
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}