aboutsummaryrefslogtreecommitdiff
path: root/test/compress/reduce_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-03-16 06:12:59 +0800
committerGitHub <noreply@github.com>2018-03-16 06:12:59 +0800
commit20ca0f5906c68df11d2f44e8b381212672afc6e1 (patch)
tree2a2fd0feb19255c26d3cd8167776804d10beb04c /test/compress/reduce_vars.js
parentb29d435bb5bc4d883a23efaabd76e95092352b6c (diff)
downloadtracifyjs-20ca0f5906c68df11d2f44e8b381212672afc6e1.tar.gz
tracifyjs-20ca0f5906c68df11d2f44e8b381212672afc6e1.zip
improve truthy compression (#3009)
Diffstat (limited to 'test/compress/reduce_vars.js')
-rw-r--r--test/compress/reduce_vars.js27
1 files changed, 17 insertions, 10 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index 815dff32..3d11ba42 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -55,7 +55,7 @@ reduce_vars: {
console.log(a - 5);
eval("console.log(a);");
})(eval);
- "yes";
+ true, "yes";
console.log(A + 1);
}
expect_stdout: true
@@ -147,7 +147,7 @@ modified: {
}
function f4() {
var b = 2, c = 3;
- b = c;
+ 1, b = c;
console.log(1 + b);
console.log(b + c);
console.log(1 + c);
@@ -715,10 +715,12 @@ passes: {
passes: 2,
reduce_funcs: true,
reduce_vars: true,
+ sequences: true,
+ side_effects: true,
unused: true,
}
input: {
- function f() {
+ (function() {
var a = 1, b = 2, c = 3;
if (a) {
b = c;
@@ -729,17 +731,22 @@ passes: {
console.log(b + c);
console.log(a + c);
console.log(a + b + c);
- }
+ })();
}
expect: {
- function f() {
- 3;
- console.log(4);
- console.log(6);
- console.log(4);
+ (function() {
+ console.log(4),
+ console.log(6),
+ console.log(4),
console.log(7);
- }
+ })();
}
+ expect_stdout: [
+ "4",
+ "6",
+ "4",
+ "7",
+ ]
}
iife: {