Simplify nested conditionals if possible

This commit is contained in:
Matt Basta
2014-02-06 12:39:13 -08:00
parent 5344b7dab8
commit ac0086a745
2 changed files with 40 additions and 0 deletions

View File

@@ -205,3 +205,30 @@ cond_4: {
some_condition(), do_something();
}
}
cond_5: {
options = {
conditionals: true
};
input: {
if (some_condition()) {
if (some_other_condition()) {
do_something();
} else {
alternate();
}
} else {
alternate();
}
if (some_condition()) {
if (some_other_condition()) {
do_something();
}
}
}
expect: {
some_condition() && some_other_condition() ? do_something() : alternate();
some_condition() && some_other_condition() && do_something();
}
}