Named unittests

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 1 06:30:40 PDT 2015


On 2015-03-31 11:08, Johannes Pfau wrote:

> But here's the problem:
>
> 1) The compile time approach requires some kind
>     of explicit registration of the unittests. At least one mixin per
>     module.
> 2) This mixin will usually provide a module constructor. But
>     using module constructors will cause issues with cycle detection.

When we get RTInfo for modules [1] there shouldn't be any problems. A 
template will be instantiated once for each module the compiler sees. 
With that module __traits(getUnitTests) and __traits(allMembers) can be 
used to access the unit tests, benchmarks, or whatever. Not need for any 
registration or module constructors.

[1] https://github.com/D-Programming-Language/dmd/pull/2271

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list