[Issue 9721] New: Code coverage for templates

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 14 09:30:29 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9721

           Summary: Code coverage for templates
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: simendsjo at gmail.com


--- Comment #0 from simendsjo <simendsjo at gmail.com> 2013-03-14 09:30:28 PDT ---
Ref.: http://forum.dlang.org/thread/wwjaeexnyaeqnqsqydte@forum.dlang.org

Is there a way to get code coverage functionality for templates to see what
parts of templates are instantiated?

t.d:
    module t;
    template t(T) {
        static if(is(T == int))
            alias int t;
        else static if(is(T == short))
            alias short t;
    }
    unittest {
        t!int a = 10;
        assert(a == 10);
    }
    void main() {}

$ dmd -unittest -cov -run t

t.lst:
       |    module t;
       |    template t(T) {
       |        static if(is(T == int))
       |            alias int t;
       |        else static if(is(T == short))
       |            alias short t;
       |    }
       |    unittest {
      1|        t!int a = 10;
      1|        assert(a == 10);
       |    }
       |    void main() {}
t.d is 100% covered

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list