aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-24 23:31:34 +0000
committerGitHub <noreply@github.com>2020-12-25 07:31:34 +0800
commitced32f9bd87e3fdc693412d1bdc924a99ecc9712 (patch)
treebc4123b8e75613971375c7bcd4d6bda348abed7c /test/compress
parentdfc3ec9cef2f8dad08471cf636f52387045b342d (diff)
downloadtracifyjs-ced32f9bd87e3fdc693412d1bdc924a99ecc9712.tar.gz
tracifyjs-ced32f9bd87e3fdc693412d1bdc924a99ecc9712.zip
enhance `default_values` (#4450)
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/default-values.js64
1 files changed, 64 insertions, 0 deletions
diff --git a/test/compress/default-values.js b/test/compress/default-values.js
index 8b9b3a95..bda32c1b 100644
--- a/test/compress/default-values.js
+++ b/test/compress/default-values.js
@@ -543,6 +543,70 @@ unused_var_2: {
node_version: ">=6"
}
+unused_value_assign_1: {
+ options = {
+ default_values: true,
+ unused: true,
+ }
+ input: {
+ [] = [ console.log("PASS") ];
+ }
+ expect: {
+ [ console.log("PASS") ];
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
+unused_value_assign_2: {
+ options = {
+ default_values: true,
+ unused: true,
+ }
+ input: {
+ [ a = console.log("FAIL") ] = [ "PASS" ];
+ console.log(a);
+ }
+ expect: {
+ [ a ] = [ "PASS" ];
+ console.log(a);
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
+unused_value_var_1: {
+ options = {
+ default_values: true,
+ unused: true,
+ }
+ input: {
+ var [] = [ console.log("PASS") ];
+ }
+ expect: {
+ console.log("PASS");
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
+unused_value_var_2: {
+ options = {
+ default_values: true,
+ unused: true,
+ }
+ input: {
+ var [ a = console.log("FAIL") ] = [ "PASS" ];
+ console.log(a);
+ }
+ expect: {
+ var [ a ] = [ "PASS" ];
+ console.log(a);
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
mangle_var_1: {
mangle = {
toplevel: false,