selectively running unittest functions

Dicebot public at dicebot.lv
Fri Oct 25 06:30:53 PDT 2013


On Friday, 25 October 2013 at 13:23:46 UTC, Daniel Davidson wrote:
> What I'm missing, and apparently others in the original thread, 
> is a way to run tests selectively. It is difficult to do with 
> unittest because they are not named. If there were a way to 
> annotate the test and pull them out that way it would be great. 
> Can it be done?

You can completely re-implement default test by using runtime 
hook http://wiki.dlang.org/Runtime_Hooks ("_d_unittest" should do 
AFAIK)

In that runner you can manually get all unittest blocks in the 
program as functions using __traits(getUnittest). One can make 
any custom decisions for running specific unittest blocks based 
on User-Defined Attributes attached to it.

Benefit of this approach is that the very same tests remain 
runnable in traditional out-of-the-box way if you don't use that 
library runner.

I remember Jacob Carlborg doing some experiments in that 
direction but did not track any further progress.


More information about the Digitalmars-d-learn mailing list