www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15580] New: Coverage Reports Should Not Count Lines in Unit

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

          Issue ID: 15580
           Summary: Coverage Reports Should Not Count Lines in Unit Test
                    Blocks
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: jack jackstouffer.com

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.

--
Jan 18 2016