--- Tim Bunce <[EMAIL PROTECTED]> wrote:
> Changing the subject slightly, is there any guidance on what people
> should write in the name/comment/label?
> 
> I ask because several times I've been puzzled by a test failure
> where the message printed is ambiguous. Compare these two:
> 
>       not ok 42 - is red
> 
>       not ok 42 - should be red
> 
> The first isn't clear whether "is red" is what's expected or what's
> actually happened.> 

Personally, I prefer a style where I had a "lead" test with a
left-justified comment and "dependent" tests with indented comments.  I
prefer, when it's done, to produce a "flowing" narrative that explains
what *should* be going on from a developer standpoint.

ok 5 - Module->can('color_name')
ok 6 - ... and color_name() should croak if called with no arguments
ok 7 - ... or if it's passed something other than a 6 digit hex value
ok 7 - ... but it should return a human readable color name for the hex
value

That should give one an overview of what's happening and then if it's
not really clear, you can dig into the actual test to see the
implementation.  It's more work than others wish to do, though.  Many
programmers seem to be happy with "is red" and this seems to lead to a
greater need to actually read the test implementation (if not the
actual code.)

Cheers,
Ovid

=====
Silence is Evil            
http://users.easystreet.com/ovid/philosophy/decency.html
Ovid                       http://www.perlmonks.org/index.pl?node_id=17000
Web Programming with Perl  http://users.easystreet.com/ovid/cgi_course/

Reply via email to