unittext extension proposal

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Aug 10 08:15:54 PDT 2009


Leandro Lucarella wrote:
> Sergey Gromov, el 10 de agosto a las 16:32 me escribiste:
>> Sat, 08 Aug 2009 17:32:30 -0400, Jeremie Pelletier wrote:
>>
>>> I just had an idea to help keep track of unittests, right now we're turning on printf's at the beginning of a test to know which one fails, and adding printfs everywhere quickly becomes redundant. Also if the test succeeds and execution fails at some other point, the last printf is then misleading.
>>>
>>> ---
>>> module sample;
>>> unittest("myTest") {}
>>> ---
>> Named unittests is a rather often requested feature.  Others also wanted
>> __UNITTEST__ to expand into a name of the current unittest.  Also a
>> 'weak assert' was requested which tests and prints a message but delays
>> exit until the end of the current unit test.
> 
> It would be nice if unittest could be extended to have import statements.

I use:

version(unittest) import std.stdio;


Andrei



More information about the Digitalmars-d mailing list