Bug 14789 – Runtime test reflection is broken

Status
RESOLVED
Resolution
INVALID
Severity
regression
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-07-09T05:48:00Z
Last change time
2015-07-09T08:20:25Z
Assigned to
nobody
Creator
public

Comments

Comment #0 by public — 2015-07-09T05:48:33Z
// 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.