enhance comparisons (#3347)

This commit is contained in:
Alex Lam S.L
2019-03-19 01:34:25 +08:00
committed by GitHub
parent 615ae37ca3
commit c520e99eda
2 changed files with 53 additions and 29 deletions

View File

@@ -323,3 +323,25 @@ is_number_unsafe: {
}
expect_stdout: "true"
}
is_boolean_var: {
options = {
comparisons: true,
reduce_vars: true,
}
input: {
console.log(function(a, b) {
for (var i = 0, c = !b; i < a.length; i++)
if (!a[i] === c)
return i;
}([ false, true ], 42));
}
expect: {
console.log(function(a, b) {
for (var i = 0, c = !b; i < a.length; i++)
if (!a[i] == c)
return i;
}([ false, true ], 42));
}
expect_stdout: "1"
}