12 ms·
An if statement without an else can have the case where line coverage does not cover the "don't take the branch" part of branch coverage. Therefore, if not taki
by rhdunn 4y ago
An if statement without an else can have the case where line coverage does not cover the "don't take the branch" part of branch coverage. Therefore, if not taking that branch results in a bug line coverage only will not pick up that bug. -- For example, if you initialize a value in an if statement's then branch but don't have a default value for it or an else branch to provide a default.
Or even if you have a ternary operator (which has an implicit if-then-else take/don't take branch) that is usually only one line.