You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you use {covr} to compute code coverage for a package that contains this function, it will be 100%.
But, note that the test covers only one of the conditions from the control statement (is.null(df)); the other two are untested and may contain bugs.
FR
Is it possible for {covr} to also take into account all conditions—either on the same line or on different lines—while computing code coverage?
With such an update, in the example above, the code coverage should be 0% because the tests don't fully cover all the conditions on that line. I am not sure what should happen if the conditional statement spans multiple lines, but I can see how 0% could be reasonable in that case as well.
This is not really distinct from #279. It's still about how R creates srcrefs. #279 (comment)
Your conditional statement is seen by R as one expression. There are no branches. Hence, covr sees it as one expression. You can try to wrap each of your conditionals with curly braces and separate them into new lines if you want.
Preamble
Consider the following code and its corresponding test:
If you use
{covr}
to compute code coverage for a package that contains this function, it will be100%
.But, note that the test covers only one of the conditions from the control statement (
is.null(df)
); the other two are untested and may contain bugs.FR
Is it possible for
{covr}
to also take into account all conditions—either on the same line or on different lines—while computing code coverage?With such an update, in the example above, the code coverage should be
0%
because the tests don't fully cover all the conditions on that line. I am not sure what should happen if the conditional statement spans multiple lines, but I can see how0%
could be reasonable in that case as well.Related to, but still distinct from #279
The text was updated successfully, but these errors were encountered: