-cov doesn't check templated code

simendsjo simendsjo at gmail.com
Thu Mar 14 09:04:11 PDT 2013


Code coverage doesn't work with templates. Is this by design?
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


More information about the Digitalmars-d-learn mailing list