aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-01-12 16:00:19 +0000
committerGitHub <noreply@github.com>2021-01-13 00:00:19 +0800
commit46ad273df49b2e320c6ee01f167fb3f9b8242213 (patch)
tree34acc8e4f307055104d006f0fae7902fefac5cd4 /test/compress
parentb689028e874e35f529b2cc1df906f70d500f6085 (diff)
downloadtracifyjs-46ad273df49b2e320c6ee01f167fb3f9b8242213.tar.gz
tracifyjs-46ad273df49b2e320c6ee01f167fb3f9b8242213.zip
enhance `rests` (#4546)
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/rests.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/compress/rests.js b/test/compress/rests.js
index e322112c..ed927700 100644
--- a/test/compress/rests.js
+++ b/test/compress/rests.js
@@ -486,6 +486,62 @@ keep_arguments: {
node_version: ">=6"
}
+drop_rest_array: {
+ options = {
+ rests: true,
+ }
+ input: {
+ var [ ...[ a ]] = [ "PASS" ];
+ console.log(a);
+ }
+ expect: {
+ var [ a ] = [ "PASS" ];
+ console.log(a);
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
+drop_rest_arrow: {
+ options = {
+ arrows: true,
+ keep_fargs: false,
+ reduce_vars: true,
+ rests: true,
+ }
+ input: {
+ console.log(((...[ a ]) => a)("PASS"));
+ }
+ expect: {
+ console.log((a => a)("PASS"));
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
+drop_rest_lambda: {
+ options = {
+ keep_fargs: false,
+ reduce_vars: true,
+ rests: true,
+ toplevel: true,
+ }
+ input: {
+ function f(...[ a ]) {
+ return a;
+ }
+ console.log(f("PASS"), f(42));
+ }
+ expect: {
+ function f(a) {
+ return a;
+ }
+ console.log(f("PASS"), f(42));
+ }
+ expect_stdout: "PASS 42"
+ node_version: ">=6"
+}
+
issue_4525_1: {
options = {
arguments: true,