aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/drop-unused.js27
-rw-r--r--test/compress/reduce_vars.js3
2 files changed, 28 insertions, 2 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js
index 99d9cace..2eefbe8d 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -1029,3 +1029,30 @@ delete_assign_2: {
}
expect_stdout: true
}
+
+drop_var: {
+ options = {
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var a;
+ console.log(a, b);
+ var a = 1, b = 2;
+ console.log(a, b);
+ var a = 3;
+ console.log(a, b);
+ }
+ expect: {
+ console.log(a, b);
+ var a = 1, b = 2;
+ console.log(a, b);
+ a = 3;
+ console.log(a, b);
+ }
+ expect_stdout: [
+ "undefined undefined",
+ "1 2",
+ "3 2",
+ ]
+}
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index 405dbc23..82b00211 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -1639,7 +1639,7 @@ redefine_arguments_1: {
return typeof arguments;
}
function g() {
- return"number";
+ return "number";
}
function h(x) {
var arguments = x;
@@ -1951,7 +1951,6 @@ pure_getters_2: {
var a = a && a.b;
}
expect: {
- var a;
var a = a && a.b;
}
}