Named unittests

deadalnix via Digitalmars-d digitalmars-d at
Tue Mar 31 20:42:08 PDT 2015

On Tuesday, 31 March 2015 at 23:29:28 UTC, Martin Nowak wrote:
> On 04/01/2015 12:58 AM, deadalnix wrote:
>> So now we are going to change the language for this ?
>> There is a natural name for unitests, the name of the module. 
>> We have
>> way to break module into pieces in a backward compatible 
>> manner now, so
>> it's all good.
> Are you saying one should split off unittests into submodules?

No necessarily.

Typically, in most test framework, you have a class, and various 
method, each of them testing various aspect of what you want to 

I see the class here as the module, and each of the method as a 
unitest block.

> Or are you saying
> is enough for your needs?
> I think having multiple tests per module makes sense, e.g. 
> because it's
> better to parallelize the tests.

See my previous comment, that is not needed. In fact i also think 
having several unitest blocks is useful.

>> We may want to add various annotation to a test, and we have 
>> UDA for that.
> Sure use a UDA, I don't care. It seems important though, that 
> the
> compiler recognizes it and emits it as metadata to the 
> ModuleInfo.
> And if you need some compiler magic anyhow, a UDA just looks 
> redundant.

How I see it, it should be possible for a user to specify a test 
runner template. This test runner template can do compile time 
reflection and format its output the way to wants.

We must not bake all required attribute we need to associate a 
test in the language. What if we want to associate the test with 
a team name, or give it a name, or give an id that my tools uses 
to check for tests, or whatever.

Every user will want to add various metadata, and these will 
vary. Every users will want various output, and these will vary.

It should be possible to have a test runner that use template and 
compile time reflection to make sense of the unitest block. Yes, 
there is a bit of compiler magic involved, but nothing terribly 

> You mean this?

We need template to use compile time reflection.

More information about the Digitalmars-d mailing list