June 27, 2010 [dmd-internals] programs exit with error code 0 on unittest failure | ||||
|---|---|---|---|---|
| ||||
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. Andrei | ||||
June 28, 2010 [dmd-internals] programs exit with error code 0 on unittest failure | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | 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 michel.fortin at michelf.com http://michelf.com/ | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply