[phobos] Silent failure of std.container unittests

Michel Fortin michel.fortin at michelf.com
Tue Jul 13 19:28:22 PDT 2010


Le 2010-07-13 à 21:54, Walter Bright a écrit :

> I received a litany of complaints about them.

I think you misinterpreted a little. Those complains were about all unit tests aborting at the first failing test. A better thing to do is to abort the current unit test on assert, then proceed with the next one. This way all unit tests are run, but only one error per test is reported.

Reporting more than one error per unit test adds meaningless garbage to the output output because the subsequent assertions are most of the time dependent on the first one succeeding (and thus do not indicate a different problem).

Personally, I'm not against a complete halt after the first assertion: it's simple and it forces you to fix the first bug it finds pronto. I understand that it does not please everyone though: some people just like to have the choice of which problem to fix first, or to get a general overview of the situation.

I think allowing one failed assertion per unit test is a good compromise. But allow more than that and you're lost in the noise of irrelevant assertions.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/





More information about the phobos mailing list