aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/reduce_vars.js90
1 files changed, 90 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index 57e23891..f7bdcb36 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -2327,3 +2327,93 @@ iife_assign: {
}
expect_stdout: "1"
}
+
+issue_1850_1: {
+ options = {
+ reduce_vars: true,
+ toplevel: false,
+ unused: true,
+ }
+ input: {
+ function f() {
+ console.log(a, a, a);
+ }
+ var a = 1;
+ f();
+ }
+ expect: {
+ function f() {
+ console.log(a, a, a);
+ }
+ var a = 1;
+ f();
+ }
+ expect_stdout: true
+}
+
+issue_1850_2: {
+ options = {
+ reduce_vars: true,
+ toplevel: "funcs",
+ unused: true,
+ }
+ input: {
+ function f() {
+ console.log(a, a, a);
+ }
+ var a = 1;
+ f();
+ }
+ expect: {
+ var a = 1;
+ (function() {
+ console.log(a, a, a);
+ })();
+ }
+ expect_stdout: true
+}
+
+issue_1850_3: {
+ options = {
+ reduce_vars: true,
+ toplevel: "vars",
+ unused: true,
+ }
+ input: {
+ function f() {
+ console.log(a, a, a);
+ }
+ var a = 1;
+ f();
+ }
+ expect: {
+ function f() {
+ console.log(a, a, a);
+ }
+ var a = 1;
+ f();
+ }
+ expect_stdout: true
+}
+
+issue_1850_4: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ function f() {
+ console.log(a, a, a);
+ }
+ var a = 1;
+ f();
+ }
+ expect: {
+ var a = 1;
+ (function() {
+ console.log(a, a, a);
+ })();
+ }
+ expect_stdout: true
+}