@@ -804,7 +804,7 @@ collapse_vars_assignment: {
|
||||
function log(x) { return console.log(x), x; }
|
||||
function f0(c) {
|
||||
var a = 3 / c;
|
||||
return a;
|
||||
return a = a;
|
||||
}
|
||||
function f1(c) {
|
||||
return 1 - 3 / c;
|
||||
|
||||
@@ -663,3 +663,122 @@ issue_3788: {
|
||||
"PASS",
|
||||
]
|
||||
}
|
||||
|
||||
issue_3789_1: {
|
||||
options = {
|
||||
join_vars: true,
|
||||
}
|
||||
input: {
|
||||
try {
|
||||
c;
|
||||
console.log("FAIL");
|
||||
} catch (e) {
|
||||
console.log("PASS");
|
||||
}
|
||||
try {} catch (c) {
|
||||
var a;
|
||||
c = 0;
|
||||
}
|
||||
}
|
||||
expect: {
|
||||
try {
|
||||
c;
|
||||
console.log("FAIL");
|
||||
} catch (e) {
|
||||
console.log("PASS");
|
||||
}
|
||||
try {} catch (c) {
|
||||
var a;
|
||||
c = 0;
|
||||
}
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
issue_3789_2: {
|
||||
options = {
|
||||
join_vars: true,
|
||||
}
|
||||
input: {
|
||||
try {
|
||||
c;
|
||||
console.log("FAIL");
|
||||
} catch (e) {
|
||||
console.log("PASS");
|
||||
}
|
||||
try {} catch (c) {
|
||||
try {} catch (c) {
|
||||
var a;
|
||||
c = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
expect: {
|
||||
try {
|
||||
c;
|
||||
console.log("FAIL");
|
||||
} catch (e) {
|
||||
console.log("PASS");
|
||||
}
|
||||
try {} catch (c) {
|
||||
try {} catch (c) {
|
||||
var a;
|
||||
c = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
issue_3791_1: {
|
||||
options = {
|
||||
collapse_vars: true,
|
||||
join_vars: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
var a = "PASS";
|
||||
switch (a) {
|
||||
case console:
|
||||
}
|
||||
var a = a;
|
||||
console.log(a);
|
||||
}
|
||||
expect: {
|
||||
var a;
|
||||
switch (a = "PASS") {
|
||||
case console:
|
||||
}
|
||||
var a = a;
|
||||
console.log(a);
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
issue_3791_2: {
|
||||
options = {
|
||||
collapse_vars: true,
|
||||
join_vars: true,
|
||||
}
|
||||
input: {
|
||||
function f(a) {
|
||||
var b;
|
||||
return b = a || g;
|
||||
function g() {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
console.log(typeof f()());
|
||||
}
|
||||
expect: {
|
||||
function f(a) {
|
||||
var b;
|
||||
return b = a || g;
|
||||
function g() {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
console.log(typeof f()());
|
||||
}
|
||||
expect_stdout: "function"
|
||||
}
|
||||
|
||||
@@ -1156,7 +1156,7 @@ for (var round = 1; round <= num_iterations; round++) {
|
||||
uglify_code = uglify_code.code;
|
||||
uglify_result = sandbox.run_code(uglify_code, toplevel);
|
||||
ok = sandbox.same_stdout(original_result, uglify_result);
|
||||
if (!ok && typeof uglify_result == "string" && o.compress.unsafe_math) {
|
||||
if (!ok && typeof uglify_result == "string" && o.compress && o.compress.unsafe_math) {
|
||||
ok = fuzzy_match(original_result, uglify_result);
|
||||
if (!ok) {
|
||||
var fuzzy_result = sandbox.run_code(original_code.replace(/( - 0\.1){3}/g, " - 0.3"), toplevel);
|
||||
|
||||
Reference in New Issue
Block a user