aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-08-23 01:51:59 +0100
committerGitHub <noreply@github.com>2021-08-23 08:51:59 +0800
commitdb94d21980583714755322d5dd26bb0850801c03 (patch)
tree6a95caf1d84cf39e9012081fbd8c7e47356c5095 /test
parent9634a9d1fd882bcd17047c285c9e3d656ba08688 (diff)
downloadtracifyjs-db94d21980583714755322d5dd26bb0850801c03.tar.gz
tracifyjs-db94d21980583714755322d5dd26bb0850801c03.zip
fix corner case in `side_effects` (#5118)
Diffstat (limited to 'test')
-rw-r--r--test/compress/default-values.js14
-rw-r--r--test/compress/rests.js18
2 files changed, 32 insertions, 0 deletions
diff --git a/test/compress/default-values.js b/test/compress/default-values.js
index 28cc46f0..13d4a18c 100644
--- a/test/compress/default-values.js
+++ b/test/compress/default-values.js
@@ -568,6 +568,20 @@ retain_empty_iife: {
node_version: ">=6"
}
+drop_new_function: {
+ options = {
+ side_effects: true,
+ }
+ input: {
+ new function(a = console.log("PASS")) {}();
+ }
+ expect: {
+ void console.log("PASS");
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
retain_fargs: {
options = {
unused: true,
diff --git a/test/compress/rests.js b/test/compress/rests.js
index a62e380a..24c6f878 100644
--- a/test/compress/rests.js
+++ b/test/compress/rests.js
@@ -636,6 +636,24 @@ keep_rest_lambda_2: {
node_version: ">=6"
}
+drop_new_function: {
+ options = {
+ side_effects: true,
+ }
+ input: {
+ new function(...{
+ [console.log("PASS")]: a,
+ }) {}();
+ }
+ expect: {
+ void ([ ... {
+ [console.log("PASS")]: [].e,
+ }] = []);
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
issue_4525_1: {
options = {
arguments: true,