aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/compress/functions.js39
-rw-r--r--test/compress/issue-281.js14
2 files changed, 46 insertions, 7 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js
index 180bb11a..1359670e 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -297,3 +297,42 @@ webkit: {
expect_exact: "console.log((function(){1+1}).a=1);"
expect_stdout: "1"
}
+
+issue_2084: {
+ options = {
+ collapse_vars: true,
+ conditionals: true,
+ evaluate: true,
+ inline: true,
+ passes: 2,
+ reduce_vars: true,
+ sequences: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ var c = 0;
+ !function() {
+ !function(c) {
+ c = 1 + c;
+ var c = 0;
+ function f14(a_1) {
+ if (c = 1 + c, 0 !== 23..toString())
+ c = 1 + c, a_1 && (a_1[0] = 0);
+ }
+ f14();
+ }(-1);
+ }();
+ console.log(c);
+ }
+ expect: {
+ var c = 0;
+ !function(c) {
+ c = 1 + c,
+ c = 1 + (c = 0),
+ 0 !== 23..toString() && (c = 1 + c);
+ }(-1),
+ console.log(c);
+ }
+ expect_stdout: "0"
+}
diff --git a/test/compress/issue-281.js b/test/compress/issue-281.js
index 7a6c03bc..9b8c8bfd 100644
--- a/test/compress/issue-281.js
+++ b/test/compress/issue-281.js
@@ -151,7 +151,7 @@ negate_iife_4: {
})();
}
expect: {
- t ? console.log(true) : console.log(false), console.log("something"), void 0;
+ t ? console.log(true) : console.log(false), void console.log("something");
}
}
@@ -174,7 +174,7 @@ negate_iife_5: {
})();
}
expect: {
- t ? foo(true) : bar(false), console.log("something"), void 0;
+ t ? foo(true) : bar(false), void console.log("something");
}
}
@@ -197,7 +197,7 @@ negate_iife_5_off: {
})();
}
expect: {
- t ? foo(true) : bar(false), console.log("something"), void 0;
+ t ? foo(true) : bar(false), void console.log("something");
}
}
@@ -214,7 +214,7 @@ issue_1254_negate_iife_true: {
};
})()();
}
- expect_exact: 'console.log("test"),void 0;'
+ expect_exact: 'void console.log("test");'
expect_stdout: true
}
@@ -231,7 +231,7 @@ issue_1254_negate_iife_nested: {
};
})()()()()();
}
- expect_exact: '(console.log("test"),void 0)()()();'
+ expect_exact: '(void console.log("test"))()()();'
}
negate_iife_issue_1073: {
@@ -382,7 +382,7 @@ wrap_iife: {
};
})()();
}
- expect_exact: 'console.log("test"),void 0;'
+ expect_exact: 'void console.log("test");'
}
wrap_iife_in_expression: {
@@ -416,7 +416,7 @@ wrap_iife_in_return_call: {
})();
})()();
}
- expect_exact: '(console.log("test"),void 0)();'
+ expect_exact: '(void console.log("test"))();'
}
pure_annotation: {