www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9721] New: Code coverage for templates

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: simendsjo gmail.com



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: -------
Mar 14 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9721


thelastmammoth gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thelastmammoth gmail.com



see also:
http://forum.dlang.org/thread/lznwctdwgrolhmqawave forum.dlang.org

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