[phobos] Silent failure of std.container unittests
Brad Roberts
braddr at puremagic.com
Fri Jul 16 22:24:01 PDT 2010
On 7/16/2010 10:08 PM, Walter Bright wrote:
>
> Yes, for that sequence, the rest are irrelevant. But what I don't
> understand is why is it so bad that they also generate messages, which
> you just ignore looking over the log file? Me, I'd rather see a few
> extra cascaded messages, fix the ones that matter and ignore the extra,
> than be short messages and have to rebuild/rerun the tests just to get
> dinged again.
As you're fond of pointing out, continuing to run past the point of broken
program state is a bad idea no matter how you decorate it.
Running beyond an assert could result in all sorts of really nasty behavior.
Consider a test that creates files and wants to clean them up, but part of the
test that decides what file to work with fails to do the right thing. The user
properly asserts on that, but then it goes and removes the 'wrong' file?
Sorry, no. I'm firmly in the 'assert stop the test' camp.
Consider another case. The user writes a helper function that lives outside a
unittest block and works exactly how the user expects. It has an assert in it.
A later refactoring moves the code directly into the unittest block rather than
the called function.. the code changes behavior? wtf?
I can't believe this debate has lasted this long.
Sigh,
Brad
More information about the phobos
mailing list