enhance booleans (#5365)
This commit is contained in:
@@ -448,6 +448,23 @@ concat_truthy: {
|
||||
]
|
||||
}
|
||||
|
||||
process_returns: {
|
||||
options = {
|
||||
booleans: true,
|
||||
}
|
||||
input: {
|
||||
(function() {
|
||||
return 42;
|
||||
})() && console.log("PASS");
|
||||
}
|
||||
expect: {
|
||||
(function() {
|
||||
return 42;
|
||||
})() && console.log("PASS");
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
issue_3465_1: {
|
||||
options = {
|
||||
booleans: true,
|
||||
|
||||
@@ -692,7 +692,7 @@ funarg_inline: {
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
process_boolean_returns: {
|
||||
process_returns: {
|
||||
options = {
|
||||
booleans: true,
|
||||
}
|
||||
@@ -706,9 +706,7 @@ process_boolean_returns: {
|
||||
expect: {
|
||||
console.log(function({ length }) {
|
||||
return length ? "FAIL" : "PASS";
|
||||
}(function() {
|
||||
return 42;
|
||||
}));
|
||||
}(function() {}));
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=6"
|
||||
|
||||
@@ -6341,7 +6341,7 @@ issue_4612_4: {
|
||||
expect: {
|
||||
console.log(function() {
|
||||
function f() {
|
||||
return h();
|
||||
h();
|
||||
}
|
||||
function g() {
|
||||
return h();
|
||||
|
||||
@@ -1144,7 +1144,7 @@ conditional_assignments_3: {
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
issue_3856: {
|
||||
issue_3856_1: {
|
||||
options = {
|
||||
booleans: true,
|
||||
conditionals: true,
|
||||
@@ -1169,9 +1169,46 @@ issue_3856: {
|
||||
console.log(function() {
|
||||
(function() {
|
||||
var a, b;
|
||||
if (a) return a, 1;
|
||||
for (a = 0; !console;);
|
||||
return 0;
|
||||
if (a) a;
|
||||
else {
|
||||
a = 0;
|
||||
for (; !console;);
|
||||
}
|
||||
})();
|
||||
}());
|
||||
}
|
||||
expect_stdout: "undefined"
|
||||
}
|
||||
|
||||
issue_3856_2: {
|
||||
options = {
|
||||
booleans: true,
|
||||
conditionals: true,
|
||||
if_return: true,
|
||||
join_vars: true,
|
||||
passes: 2,
|
||||
sequences: true,
|
||||
side_effects: true,
|
||||
}
|
||||
input: {
|
||||
console.log(function() {
|
||||
(function() {
|
||||
var a;
|
||||
if (!a) {
|
||||
a = 0;
|
||||
for (var b; !console;);
|
||||
return 0;
|
||||
}
|
||||
if (a) return 1;
|
||||
})();
|
||||
}());
|
||||
}
|
||||
expect: {
|
||||
console.log(function() {
|
||||
(function() {
|
||||
var a, b;
|
||||
if (!a)
|
||||
for (a = 0; !console;);
|
||||
})();
|
||||
}());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user