[Issue 14855] -cov should ignore assert(0)
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Aug 7 23:34:08 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=14855
Iain Buclaw <ibuclaw at gdcproject.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ibuclaw at gdcproject.org
--- Comment #6 from Iain Buclaw <ibuclaw at gdcproject.org> ---
(In reply to Jonathan M Davis from comment #5)
> > Maybe we can add a compiler flag or API in Druntime to change the behavior based on a user's opinion?
>
> Much as I would love to see assert(0) not counted towards the coverage, I
> think that we should avoid extra compiler flags for stuff like this, and
> Walter is generally opposed to adding compiler flags without a really good
> reason, so I'd be pretty shocked if he'd agree to one for this. If he were
> convinced that it mattered enough to consider it, he'd just agree to change
> the normal behavior.
>
> At this point, expect that the options are:
>
> 1. Just put up with how things are and fail to get 100% code coverage in a
> number of cases because of this issue.
>
I'd say just put up with it. Code that we *know* is unreachable can only be
considered good if it's never hit. :-)
There are always ways to refactor code so that you get 100% hit without
compromising code correctness. Such as using enforce + final switch.
> 3. Use a different code coverage tool. I don't know how possible that would
> be with dmd, but it should work with gdc or ldc.
>
Different coverage tools would still have the same outcome though.
--
More information about the Digitalmars-d-bugs
mailing list