"Try it now"

Jonathan M Davis jmdavisProg at gmx.com
Thu Apr 14 10:19:15 PDT 2011


> On 04/14/2011 04:22 PM, Andrei Alexandrescu wrote:
> > On 4/14/11 6:52 AM, spir wrote:
> >> On 04/14/2011 01:11 AM, bearophile wrote:
> >>>> * Since most of them don't actually output anything, the program
> >>>> 
> >>>> > now detects output.length == 0 and says "Program run
> >>>> > successfully." upon completion to give some feedback.
> >>> 
> >>> This is a problem. Unittest code is not meant to produce an output,
> >>> while online snippets to try are meant to nearly always produce a
> >>> meaningful output.
> >> 
> >> All my unittest blocks produce meaningful output; there exist firstly
> >> for that. Am I an heretic?
> > 
> > No, you're just doing it wrong. Heretic might be sometimes good.
> > 
> > http://www.linfo.org/rule_of_silence.html
> 
> Right, I know that and totally disagree. This rule is IMO the exact
> opposite of human-friendliness (numerous authors on usability and friends
> share this opinion, indeed).
> Also, this is not what I'm talking about: I'm not here expecting just "all
> fine, brother", but various data helping me and understand how things
> actually worked; to be short, data useful to the coder during development
> or debug. See also reply to Steven's post.

And I have no clue what you'd want to print. Normally, if the assertion 
passes, everything's fine. Seeing output from it would just be noise. Now, 
being able to verify that a particular unit test block is running when you're 
dealing with version blocks could be useful periodically, but all you really 
need to verify is that the test is run, not what it's doing. If you need to 
debug it, you debug it. And if you need to debug it, usually the assertions 
would be failing anyway. Having debug output printing all of the time would 
just get in the way and make it harder to find what you need when you're 
actually debugging, since you'd have too much debug output if everything's 
printing debug output. So, I really don't understand what you'd be looking to 
print.

I can understand someone wanting the list of tests printed so that they could 
see where in the tests the program is, but generally, all you need to know is 
whether the tests failed, and seeing the failed assertions gives you that. So, 
ultimately, I don't really understand the push for stuff being printed during 
unit tests unless you're explicitly debugging a unit test.

- Jonathan M Davis


More information about the Digitalmars-d mailing list