digitalmars.D.learn - -cov doesn't check templated code
- simendsjo (29/29) Mar 14 2013 Code coverage doesn't work with templates. Is this by design?
- bearophile (6/7) Mar 14 2013 A code coverage tells how many time a line of code is run at
- simendsjo (3/8) Mar 14 2013 Makes sense. Would be nice to easily see that the templates are
- bearophile (7/9) Mar 14 2013 Then add an enhancement request in bugzilla. Maybe there is a way
- simendsjo (2/11) Mar 14 2013 Ok: http://d.puremagic.com/issues/show_bug.cgi?id=9721
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
Mar 14 2013
simendsjo:Code coverage doesn't work with templates. Is this by design?A code coverage tells how many time a line of code is run at run-time. But your template contains no code that is run at run-time. So you are looking for a different kind of counter. Bye, bearophile
Mar 14 2013
On Thursday, 14 March 2013 at 16:09:01 UTC, bearophile wrote:simendsjo:Makes sense. Would be nice to easily see that the templates are being tested more properly though.Code coverage doesn't work with templates. Is this by design?A code coverage tells how many time a line of code is run at run-time. But your template contains no code that is run at run-time. So you are looking for a different kind of counter.
Mar 14 2013
simendsjo:Would be nice to easily see that the templates are being tested more properly though.Then add an enhancement request in bugzilla. Maybe there is a way to implement it. I remember someone asking for a compiler switch that lists all the implemented templates... Bye, bearophile
Mar 14 2013
On Thursday, 14 March 2013 at 16:26:21 UTC, bearophile wrote:simendsjo:Ok: http://d.puremagic.com/issues/show_bug.cgi?id=9721Would be nice to easily see that the templates are being tested more properly though.Then add an enhancement request in bugzilla. Maybe there is a way to implement it. I remember someone asking for a compiler switch that lists all the implemented templates... Bye, bearophile
Mar 14 2013