[Issue 2749] Make unittests named and nestable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 21 11:33:57 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2749


smjg at iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg at iname.com




------- Comment #5 from smjg at iname.com  2009-03-21 13:34 -------
(In reply to comment #0)
> The current unit tests lack some functionality. 
> - The current unit tests are not named.
> - There is no output that specifically indicates that the tests were run.

I often put writefln statements in my unittests, which seem to solve that
problem.

> - A single failing test will prevent all other tests from running.
> - There is no indication of which test failed.

If, as in your example, all assert statements are within the unittest code,
then how is the line number in the assert error message not an indication?

If you're calling functions to do the asserts, and so you can't tell what in
the unittest triggered it, then the aforementioned writefln statements are one
way around it.

> unittest ("XML") {

Why make the unittest names strings, rather than identifiers?

So if I'm understanding correctly:
- Each unittest block would have a pass/fail condition.
- When an assert is thrown, the immediately containing unittest fails and exits
immediately.
- If one unittest fails, the next will be run, but any unittest it's nested
within would fail.

Have I got this right?  Moreover, would it be legal for statements to follow
nested unittests within a unittest?  How would these be handled?


-- 



More information about the Digitalmars-d-bugs mailing list