// wat.d
import core.runtime;
import std.stdio;
unittest
{
writeln("in test");
assert(false);
}
bool dummyUnitTestRunner()
{
foreach ( m; ModuleInfo )
{
if (m.unitTest !is null)
{
writefln("running tests for %s", m.name);
m.unitTest();
}
}
return true;
}
static this ( )
{
Runtime.moduleUnitTester(&dummyUnitTestRunner);
}
// output:
// running tests for wat
Comment #1 by public — 2015-07-09T05:49:39Z
It has been broken for several version at least (checked up to 2.066)
Comment #2 by public — 2015-07-09T08:20:04Z
Ah, I see, this happens because m.unitTest is actually a delegate getter and is not called here at all, it must be m.unitTest()() >_<
I hate optional parens so much.