unittest vs exceptions?
Tobias Pankrath
tobias at pankrath.net
Sat Aug 4 16:01:03 PDT 2012
On Saturday, 4 August 2012 at 22:26:26 UTC, Jonathan M Davis
wrote:
> On Sunday, August 05, 2012 00:15:49 David Nadlinger wrote:
>> A failed unit test really just means that a unit test block is
>> left via an exception. Currently, it just bubbles up to the
>> druntime main(), where it is printed to console and causes a
>> non-zero exit code, but future unit test frameworks could
>> handle
>> this in a more advanced way.
>
> They could, but I think that it's pretty normal to just treat
> any thrown
> exception as a test failure. The only difference here and what
> I've seen in
> other test frameworks, is that most test frameworks would
> actually tell you
> what test failed, which really doesn't work in D, since
> unittest blocks are
> unnamed (whereas most unit test frameworks used named tests).
> That's one of
> the reasons why I'd love it if we could start naming unittest
> blocks, but in
> spite of some interest in such a feature, no one has
> implemented it yet.
>
> - Jonathan M Davis
you can do it as a library solution just fine.
More information about the Digitalmars-d-learn
mailing list