[Issue 14855] -cov should ignore assert(0)

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Aug 6 02:37:02 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=14855

--- Comment #3 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
(In reply to Walter Bright from comment #2)
> Being concerned about assert(0)'s not being executed is placing too
> much emphasis on the metric.

Perhaps, but if you're trying to make sure that you tested every line that
you're supposed to test, assert(0) is not on the list of lines that should ever
be run. In fact, if the code is correct, it shouldn't even be testable, because
it shouldn't be reachable. So, if the point of the code coverage metric is to
show whether your tests actually run every reachable line of code, then
including assert(0) in the total is incorrect and counterproductive. It's
certainly not the end of the world, but I don't see why there is any value in
counting assert(0) in the coverage, and there's definitely value in not
counting it.

--


More information about the Digitalmars-d-bugs mailing list