selectively running unittest functions

Daniel Davidson nospam at spam.com
Fri Oct 25 06:45:28 PDT 2013


On Friday, 25 October 2013 at 13:30:54 UTC, Dicebot wrote:
> 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)
>

Pretty sure this is what I'm doing. Only I did not know you could 
UDA a unittest.

> 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.
>

Any samples of how to use __traits(getUnittest,...). I might be 
able to work as you suggest if I can get this to work.

> 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