DUnit: Advanced unit testing toolkit.

Jacob Carlborg doob at me.com
Wed Sep 25 13:59:58 PDT 2013


On Wednesday, 25 September 2013 at 20:18:57 UTC, Gary Willoughby 
wrote:

> That looks interesting but the unittester handler seems to run 
> instead of the unittest blocks

I'm not exactly sure what you mean. But this is how it works. DMD 
turns each unit test block into a function. Then DMD creates a 
single function for each module, which will call all these unit 
test functions. If you access the "unitTest" [1] property of a 
ModuleInfo you will get the unit test runner and not the 
individual unit test functions.

To access the individual unit test functions you can use the 
getUnitTests trait, available in git HEAD:

https://github.com/D-Programming-Language/dlang.org/pull/366

> and the assert handler property is private.

There are property functions at line 374 and below to set the 
assert handler.

[1] 
https://github.com/D-Programming-Language/druntime/blob/master/src/object.di#L284

--
/Jacob Carlborg


More information about the Digitalmars-d-announce mailing list