www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13524] New: -cov does not account for inline conditionals


          Issue ID: 13524
           Summary: -cov does not account for inline conditionals
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: andrei erdani.com

Executing code with -cov does not account for things like:

auto x = condition ? fun() : gun();

If condition is always the same, one of the function calls isn't covered, and
cov does not detect that. Writing the condition on 2-3 lines does work, but
coverage analysis shouldn't require code reformatting.

(Same goes about the arguably less frequent

if (condition) fun(); else gun();

and other constructs that cram several statements on one line.)

Thoughts on how we could fix that? One idea for output is to write "000:nnn"
instead of the customary "0000000", where nnn is the column number (999 for

Would this be doable?

Sep 23 2014