aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/functions.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js
index 6d41a265..7c6ebe03 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -6346,3 +6346,55 @@ issue_5046: {
}
expect_stdout: "PASS"
}
+
+issue_5061_1: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ toplevel: true,
+ }
+ input: {
+ var f, a = 1;
+ (f = function() {
+ console.log(a ? "foo" : "bar");
+ })();
+ f(a = 0);
+ }
+ expect: {
+ var f, a = 1;
+ (f = function() {
+ console.log(a ? "foo" : "bar");
+ })();
+ f(a = 0);
+ }
+ expect_stdout: [
+ "foo",
+ "bar",
+ ]
+}
+
+issue_5061_2: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var f, a = 1;
+ (f = function() {
+ console.log(a ? "foo" : "bar");
+ })();
+ f(a = 0);
+ }
+ expect: {
+ var f, a = 1;
+ (f = function() {
+ console.log(a ? "foo" : "bar");
+ })();
+ f(a = 0);
+ }
+ expect_stdout: [
+ "foo",
+ "bar",
+ ]
+}