aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-11-19 03:25:36 +0000
committerGitHub <noreply@github.com>2020-11-19 11:25:36 +0800
commit641406d4910a8991cbd41b0814fedd5f38958850 (patch)
treebc68e1bbc75b2aab74c3291046b5ae2961eb0934 /test
parent134ef0b1eb5e7ec0fc02e3aa0f36e319b4b82ac4 (diff)
downloadtracifyjs-641406d4910a8991cbd41b0814fedd5f38958850.tar.gz
tracifyjs-641406d4910a8991cbd41b0814fedd5f38958850.zip
fix corner cases in `reduce_vars` & `unused` (#4306)
Diffstat (limited to 'test')
-rw-r--r--test/compress/const.js48
-rw-r--r--test/compress/let.js52
2 files changed, 100 insertions, 0 deletions
diff --git a/test/compress/const.js b/test/compress/const.js
index 7e393d4f..8dbe74da 100644
--- a/test/compress/const.js
+++ b/test/compress/const.js
@@ -1257,3 +1257,51 @@ issue_4290_1: {
}
expect_stdout: true
}
+
+issue_4305_1: {
+ options = {
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ (function() {
+ const arguments = function() {
+ while (console.log("PASS"));
+ };
+ arguments();
+ })();
+ }
+ expect: {
+ (function() {
+ const arguments = function() {
+ while (console.log("PASS"));
+ };
+ arguments();
+ })();
+ }
+ expect_stdout: true
+}
+
+issue_4305_2: {
+ options = {
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ (function(a) {
+ const a = function() {
+ while (console.log("aaaaa"));
+ };
+ a();
+ })();
+ }
+ expect: {
+ (function(a) {
+ const a = function() {
+ while (console.log("aaaaa"));
+ };
+ a();
+ })();
+ }
+ expect_stdout: true
+}
diff --git a/test/compress/let.js b/test/compress/let.js
index 0669b36f..76641c3f 100644
--- a/test/compress/let.js
+++ b/test/compress/let.js
@@ -1134,3 +1134,55 @@ issue_4290_2: {
expect_stdout: "PASS"
node_version: ">=4"
}
+
+issue_4305_1: {
+ options = {
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ (function() {
+ let arguments = function() {
+ while (console.log("PASS"));
+ };
+ arguments();
+ })();
+ }
+ expect: {
+ (function() {
+ let arguments = function() {
+ while (console.log("PASS"));
+ };
+ arguments();
+ })();
+ }
+ expect_stdout: true
+ node_version: ">=6"
+}
+
+issue_4305_2: {
+ options = {
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ "use strict";
+ (function(a) {
+ let a = function() {
+ while (console.log("aaaaa"));
+ };
+ a();
+ })();
+ }
+ expect: {
+ "use strict";
+ (function(a) {
+ let a = function() {
+ while (console.log("aaaaa"));
+ };
+ a();
+ })();
+ }
+ expect_stdout: true
+ node_version: ">=4"
+}