ModuleInfo, factories, and unittesting
Atila Neves via Digitalmars-d
digitalmars-d at puremagic.com
Mon Dec 19 09:03:43 PST 2016
On Monday, 19 December 2016 at 00:00:36 UTC, Andrei Alexandrescu
wrote:
> On 12/18/16 6:48 PM, Nicholas Wilson wrote:
>> On Sunday, 18 December 2016 at 16:53:24 UTC, Andrei
>> Alexandrescu wrote:
>>>[...]
>>
>> Don't forget that typeinfos are classes too, which makes the
>> class
>> attribute approach less attractive.
>>
>>>[...]
>>
>> Module (static) ctors & dtors need MI.
>
> Cool cool cool. Thanks.
>
>>>[...]
>>
>> We have __traits(getUnitTests,...) but the way to do DIY
>> unittests is
>> foreach(m; ModuleInfo)
>> foreach(test; __traits(getUnitTests,m)
>> test();
>
> Noice. Wait, the top foreach iterates what?
All the ModuleInfos in the binary. This confused the hell out of
me when I was starting to learn D, since unit-threaded was my
first project.
Atila
More information about the Digitalmars-d
mailing list