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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 27 23:28:32 UTC 2018


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

--- Comment #7 from hsteoh at quickfur.ath.cx ---
To me it doesn't make sense that `assert(0);` should be counted towards
coverage.  I mean, `assert(0);` is basically the programmer telling the
compiler "this is not supposed to happen" and "this is unreachable code",
meaning that if execution ever gets to this point, the code is wrong and the
program is in an invalid state.  On the flip side, if everything else except
assert(0) were reached during execution, then surely that means the code is
100% covered, since the assert(0)'s are not supposed to ever happen, from the
language's POV.

--


More information about the Digitalmars-d-bugs mailing list