"Try it now"

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Apr 14 10:09:35 PDT 2011


On 4/14/11 10:34 AM, spir wrote:
> 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 is a good cue to revisit your opinion.

> This rule is IMO the exact
> opposite of human-friendliness (numerous authors on usability and
> friends share this opinion, indeed).

This may be a misunderstanding of a valid human friendliness concern 
with a simple mistake. In addition, you reject an authoritative text 
with an appeal to an undefined authority.

Applying "let me output something and eye it" at the level of each unit 
test does not scale because it makes it extremely difficult to identify 
issues once one test of many produces unexpected output. There are 
programs (such as "expect") that automate that task. The ultimate goal 
is to make errors noisy and easy to identify.

> 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.

I understand, and I repeat: that approach works great for exploration, 
but won't scale for systematic unit testing.


Andrei


More information about the Digitalmars-d mailing list