unittext extension proposal

Jeremie Pelletier jeremiep at gmail.com
Mon Aug 10 08:32:35 PDT 2009


Andrei Alexandrescu Wrote:

> 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

Thats the thing, I dont need every unittest compile to fill stdout with progress status. It's only needed when you have 300 unittests in a single module and you cant tell which one is failing.

I for myself use an additional debug(TEST) check alongside with version(unittest) for my test tracing features.



More information about the Digitalmars-d mailing list