Bug 15327 – -cov should not mark `assert(0)` (and ideally paths leading unconditionally to it) as uncovered
Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-11-13T13:28:00Z
Last change time
2015-11-13T14:41:08Z
Assigned to
nobody
Creator
andrei
Comments
Comment #0 by andrei — 2015-11-13T13:28:57Z
`assert(0)` is almost always used as a "waveguide terminator" to mark paths that, if ever reached, mean there's a bug in the code. Consequently, the `assert(0)` lines and all paths leading to them cannot and should not ever be covered.
Currently such lines are marked with 0000000 and gratuitously degrade the coverage ratio of legitimate code.
A simple fix would be to not mark `assert(0)` lines as uncovered (also `assert(false)` etc). That would be enough to close this issue. A more sophisticated approach would also do the same with code leading up to the `assert(0)`.
Comment #1 by issues.dlang — 2015-11-13T14:41:08Z
*** This issue has been marked as a duplicate of issue 14855 ***