Bug 15580 – Coverage Reports Should Not Count Lines in Unit Test Blocks

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-01-18T16:46:12Z
Last change time
2019-11-28T12:43:28Z
Assigned to
No Owner
Creator
Jack Stouffer

Comments

Comment #0 by jack — 2016-01-18T16:46:12Z
Consider the following code unittest { struct G { int opCall (int i) { return 1;} } alias ShouldBeInt = ReturnType!G; static assert(is(ShouldBeInt == int)); } This is from a unit test block in std.traits. The coverage report gives |unittest |{ 1| struct G | { 0000000| int opCall (int i) { return 1;} | } | 1| alias ShouldBeInt = ReturnType!G; | static assert(is(ShouldBeInt == int)); |} This is misleading, the line is technically never called during run time, but it is used.
Comment #1 by code — 2017-06-14T08:46:17Z
That's debatable, knowing what unittests ran is also useful. Different ratios for overall coverage would make sense though.
Comment #2 by bugzilla — 2019-11-28T12:43:28Z
*** This issue has been marked as a duplicate of issue 14856 ***