Named unittests

Martin Nowak via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 31 16:29:06 PDT 2015


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?

Or are you saying
https://github.com/D-Programming-Language/druntime/blob/3656ba9469a60b4b23bb4a3cd95812b4f410b8a1/src/test_runner.d
is enough for your needs?

I think having multiple tests per module makes sense, e.g. because it's
better to parallelize the tests.

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

@unittest("my test") unittest

unittest("my test")

> So the only things that is really needed is a way to customize the test
> runner from client code to output whatever everybody needs.

You mean this?
http://dlang.org/phobos/core_runtime.html#.Runtime.moduleUnitTester


More information about the Digitalmars-d mailing list