Liskov principle and unittest

Tobias Pankrath tobias at pankrath.net
Fri Sep 23 03:13:50 PDT 2011


The only thing that D unittest do, is executing code if you
pass -unittest to the compiler. What you do in this code is entirely
up to you. 

So, I think the answer is no. No you can't do this with
the current language and standard library. 

When I started learning D, I thought the way D handles unit tests is
very limited compared to libraries in other languages. However D makes
it straight forward and simple to build something more elaborate.

So what I'm doing now, is to register delegates as unit tests, so I can
get a statistic telling me, how many pass and how many fail.

I think it is doable in an similar way to associate test cases with
classes and for every subclass look if a test case should be inherited
from the baseclass using Ds compile time reflection capabilities.




More information about the Digitalmars-d mailing list