I have a branch that I never expect to encounter, and I'm wondering how to mark the throw
in this branch as being OK so that doesn't red flag during code coverage.
if ....
else
throw("I should never get here")
end
In my experience code coverage tools are fairly inflexible, and even, arguably kind of bullshit. For example, you can change the above to one line condition && error("I should never get here")
and most code coverage tools will count that as covered, whereas in the above form it will think it missed a line. That is, code coverage doesn't count branches or anything like that, it's a very superficial and unsophisticated analysis.
I'm certainly no expert in code coverage, but everything I've seen suggests to me that code coverage is a "rough estimate not to be taken too seriously"
coverage.py supports # pragma: no cover
syntax, but I don't know if it works for Julia
Last updated: Dec 28 2024 at 04:38 UTC