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

Reply via email to