enhance assignments, booleans & conditionals (#5691)
This commit is contained in:
@@ -80,6 +80,25 @@ de_morgan_1c: {
|
||||
expect_stdout: "true"
|
||||
}
|
||||
|
||||
de_morgan_1d: {
|
||||
options = {
|
||||
booleans: true,
|
||||
}
|
||||
input: {
|
||||
function f(a) {
|
||||
return (a = false) || a;
|
||||
}
|
||||
console.log(f(null), f(42));
|
||||
}
|
||||
expect: {
|
||||
function f(a) {
|
||||
return a = !1;
|
||||
}
|
||||
console.log(f(null), f(42));
|
||||
}
|
||||
expect_stdout: "false false"
|
||||
}
|
||||
|
||||
de_morgan_2a: {
|
||||
options = {
|
||||
booleans: true,
|
||||
@@ -181,6 +200,31 @@ de_morgan_2d: {
|
||||
]
|
||||
}
|
||||
|
||||
de_morgan_2e: {
|
||||
options = {
|
||||
booleans: true,
|
||||
conditionals: true,
|
||||
}
|
||||
input: {
|
||||
function f(a, b) {
|
||||
return (a && b) && b;
|
||||
}
|
||||
console.log(f(null), f(null, {}));
|
||||
console.log(f(42), f(42, {}));
|
||||
}
|
||||
expect: {
|
||||
function f(a, b) {
|
||||
return a && b;
|
||||
}
|
||||
console.log(f(null), f(null, {}));
|
||||
console.log(f(42), f(42, {}));
|
||||
}
|
||||
expect_stdout: [
|
||||
"null null",
|
||||
"undefined {}",
|
||||
]
|
||||
}
|
||||
|
||||
de_morgan_3a: {
|
||||
options = {
|
||||
booleans: true,
|
||||
|
||||
Reference in New Issue
Block a user