ModuleInfo.unitTest cannot be called twice

Jacob Carlborg doob at me.com
Wed Dec 12 13:00:55 PST 2012


It seems it's not possible to call ModuleInfo.unitTest more than once.

The following code will not run the unit tests:

foreach (m ; ModuleInfo)
     if (m && m.unitTest)
         m.unitTest();

But this code will:

foreach (m ; ModuleInfo)
     if (m)
         if (auto fp = m.unitTest)
             fp();

Not that I'm storing the result of "m.unitTest" in a variable in the 
second example.

Am I doing something wrong here or is this a bug?

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list