On Mon, Jul 15, 2013 at 10:34 AM, Jacob Carlborg <[email protected]> wrote:
> Recently I added a new trait to get all the unit tests functions from a > module. With this in place, among other things, it's possible to do unit > tests for CTFE functions. Here's a quick try: > > http://pastebin.com/Kk0in3bD > > great, thanks > What's missing is CTFE-able "writeln". > awaiting https://github.com/D-Programming-Language/dmd/pull/692 or CTFE exec > It's also possible to implement named unit tests in library code, now when > it's possible to access UDA's from the unit test functions. I would still prefer the short and sweet syntax: unittest(myunittestname){...} rather than the cumbersome: @named("myunittestname") unittest{...} These named unittests would ideally be referable to inside DDOC (as opposed to current horrible practice of duplicating examples inside documentation, which are never in sync) Later, for a more complete testing infrastructure, we would need additional attributes indicating for example whether the unittest is near-instantaneous or takes a long time to run (to filter out slow ones when needed)
