Le 2010-06-27 à 17:30, Andrei Alexandrescu a écrit :
> When a unittest fails the program must end with a nonzero exit code. This has
> been the case until the last change (which I continue to dislike) that makes
> assert() only print an error message inside unittests.
I agree. There's two awkward things with how it works currently:
1. assert prints an error message, then the unittest continues. In all other
unit test frameworks, the test abort, even though generally other tests after
it are run.
2. When a unit test fails, the program runs as if nothing happened. I have a
program that outputs a lot to the console, and it's easy to miss a few
assertion errors at the top when the screen is quickly filled with the
program's output and the errors go off screen.
Personally, I preferred the old behaviour, by a lot.
Assertions should be fatal errors. In a unit test it might be desirable to
postpone exiting until the other tests are run, but that's useful mostly when
displayed in conjunction with a list of failed tests. It's rarely useful to see
multiple assertions within the same unittest{} block. And the program shouldn't
be started (at least not by default) when a unit test has failed.
--
Michel Fortin
[email protected]
http://michelf.com/
_______________________________________________
dmd-internals mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-internals