aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/functions.js71
-rw-r--r--test/compress/issue-2719.js2
-rw-r--r--test/compress/reduce_vars.js3
3 files changed, 53 insertions, 23 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js
index b1a44ffa..4a192d59 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -1020,9 +1020,7 @@ issue_2616: {
}
expect: {
var c = "FAIL";
- !function(NaN) {
- (true << NaN) - 0/0 || (c = "PASS");
- }([]);
+ (true << []) - NaN || (c = "PASS");
console.log(c);
}
expect_stdout: "PASS"
@@ -1607,7 +1605,31 @@ duplicate_argnames_2: {
}
expect: {
var a = "PASS";
- console, b && (a = "FAIL");
+ console, void 0 && (a = "FAIL");
+ console.log(a);
+ }
+ expect_stdout: "PASS"
+}
+
+duplicate_argnames_3: {
+ options = {
+ inline: true,
+ reduce_vars: true,
+ side_effects: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var a = "FAIL";
+ function f(b, b, b) {
+ b && (a = "PASS");
+ }
+ f(null, 0, console, "42".toString());
+ console.log(a);
+ }
+ expect: {
+ var a = "FAIL";
+ b = console, "42".toString(), b && (a = "PASS");
var b;
console.log(a);
}
@@ -1766,8 +1788,7 @@ inline_2: {
}
expect: {
console.log(1);
- a = 2, console.log(a);
- var a;
+ console.log(2);
(function(b) {
var c = b;
console.log(c);
@@ -1800,8 +1821,7 @@ inline_3: {
}
expect: {
console.log(1);
- a = 2, console.log(a);
- var a;
+ console.log(2);
b = 3, c = b, console.log(c);
var b, c;
}
@@ -1832,8 +1852,7 @@ inline_true: {
}
expect: {
console.log(1);
- a = 2, console.log(a);
- var a;
+ console.log(2);
b = 3, c = b, console.log(c);
var b, c;
}
@@ -1897,7 +1916,24 @@ duplicate_arg_var_2: {
}("PA"));
}
expect: {
- console.log((b = "PA", b + "SS"));
+ console.log("PA" + "SS");
+ }
+ expect_stdout: "PASS"
+}
+
+duplicate_arg_var_3: {
+ options = {
+ inline: true,
+ toplevel: true,
+ }
+ input: {
+ console.log(function(b) {
+ return b + "SS";
+ var b;
+ }("PA", "42".toString()));
+ }
+ expect: {
+ console.log((b = "PA", "42".toString(), b + "SS"));
var b;
}
expect_stdout: "PASS"
@@ -2045,10 +2081,8 @@ issue_3016_1: {
expect: {
var b = 1;
do {
- a = 3,
- a[b];
+ 3[b];
} while(0);
- var a;
console.log(b);
}
expect_stdout: "1"
@@ -2556,10 +2590,9 @@ cross_references_2: {
options = {
collapse_vars: true,
evaluate: true,
- hoist_props: true,
inline: true,
- passes: 4,
- pure_getters: true,
+ passes: 6,
+ properties: true,
reduce_vars: true,
sequences: true,
side_effects: true,
@@ -3685,9 +3718,7 @@ pr_3595_3: {
var g = [ "PASS" ];
console.log(function(problem) {
return g[problem];
- }(function(arg) {
- return g.indexOf(arg);
- }("PASS")));
+ }(g.indexOf("PASS")));
}
expect_stdout: "PASS"
}
diff --git a/test/compress/issue-2719.js b/test/compress/issue-2719.js
index dc37f404..f11d0077 100644
--- a/test/compress/issue-2719.js
+++ b/test/compress/issue-2719.js
@@ -26,7 +26,7 @@ warn: {
}().length);
}
expect_warnings: [
- "WARN: Function.prototype.caller not supported [test/compress/issue-2719.js:5,19]",
"WARN: Function.prototype.arguments not supported [test/compress/issue-2719.js:5,19]",
+ "WARN: Function.prototype.caller not supported [test/compress/issue-2719.js:5,19]",
]
}
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index 6db0a477..85ca6bd6 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -2289,11 +2289,10 @@ redefine_farg_2: {
console.log(f([]), g([]), h([]));
}
expect: {
- console.log((a = [], typeof a), "number",function(a, b) {
+ console.log(typeof [], "number",function(a, b) {
a = b;
return typeof a;
}([]));
- var a;
}
expect_stdout: "object number undefined"
}