aboutsummaryrefslogtreecommitdiff
path: root/test/compress/reduce_vars.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress/reduce_vars.js')
-rw-r--r--test/compress/reduce_vars.js93
1 files changed, 92 insertions, 1 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index a18d4256..7714ad5d 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -3397,6 +3397,10 @@ issue_2423_1: {
p();
p();
}
+ expect_stdout: [
+ "1",
+ "1",
+ ]
}
issue_2423_2: {
@@ -3417,6 +3421,10 @@ issue_2423_2: {
p();
p();
}
+ expect_stdout: [
+ "1",
+ "1",
+ ]
}
issue_2423_3: {
@@ -3433,12 +3441,14 @@ issue_2423_3: {
expect: {
(function() { console.log(function() { return 1; }()); })();
}
+ expect_stdout: "1"
}
issue_2423_4: {
options = {
inline: true,
reduce_vars: true,
+ side_effects: true,
toplevel: true,
unused: true,
}
@@ -3448,6 +3458,87 @@ issue_2423_4: {
p();
}
expect: {
- void console.log(1);
+ console.log(1);
+ }
+ expect_stdout: "1"
+}
+
+issue_2423_5: {
+ options = {
+ inline: true,
+ passes: 2,
+ reduce_vars: true,
+ side_effects: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ function x() {
+ y();
+ }
+ function y() {
+ console.log(1);
+ }
+ function z() {
+ function y() {
+ console.log(2);
+ }
+ x();
+ }
+ z();
+ z();
+ }
+ expect: {
+ function z() {
+ console.log(1);
+ }
+ z();
+ z();
}
+ expect_stdout: [
+ "1",
+ "1",
+ ]
+}
+
+issue_2423_6: {
+ options = {
+ inline: true,
+ passes: 2,
+ reduce_vars: true,
+ side_effects: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ function x() {
+ y();
+ }
+ function y() {
+ console.log(1);
+ }
+ function z() {
+ function y() {
+ console.log(2);
+ }
+ x();
+ y();
+ }
+ z();
+ z();
+ }
+ expect: {
+ function z(){
+ console.log(1);
+ console.log(2);
+ }
+ z();
+ z();
+ }
+ expect_stdout: [
+ "1",
+ "2",
+ "1",
+ "2",
+ ]
}