New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Condition plus branch coverage #561
Comments
This is not really distinct from #279. It's still about how R creates 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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: