Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: Re: Testaholics Anonymous (or how I learned to stop worrying and love Test::More)

by stvn (Monsignor)
on Mar 31, 2004 at 22:56 UTC ( #341452=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Testaholics Anonymous (or how I learned to stop worrying and love Test::More)
in thread Testaholics Anonymous (or how I learned to stop worrying and love Test::More)

Ovid

I am actually running some of my tests through Devel::Cover right now, and and something just popped up.

What about on coverage for things like this:

return wantarray ? @results : \@results;
Devel::Cover reports that I have only tested the @results return value branch. Should I test the \@results branch too, or is this being too granular?

-stvn


Comment on Re: Re: Re: Testaholics Anonymous (or how I learned to stop worrying and love Test::More)
Select or Download Code
Re: Re: Re: Re: Testaholics Anonymous (or how I learned to stop worrying and love Test::More)
by Ovid (Cardinal) on Apr 01, 2004 at 00:40 UTC

    Personally, I think something like that is too trivial to test -- until it breaks. If that's the only thing that Devel::Cover says you've missed, go ahead and toss the test in there if you like. Otherwise, concentrate on the "big ticket items" and only test that if it breaks (or if you feel like it. Some people are happy to test everything).

    Cheers,
    Ovid

    New address of my CGI Course.

Re(4): More tests or dead code?
by Ovid (Cardinal) on Apr 01, 2004 at 01:52 UTC

    You know, one thing that I forgot to mention, but it's vitally important to remember: if you find out you didn't test something, you might want to ask yourself if you have dead code. In your example, do you ever call that code in scalar context? (well, void context would also exercise that condition, but we'll ignore that) If not, you have dead code. If you do call it in scalar context, why are you overloading the return value? If you don't need to, perhaps this is an opportunity to simplify your code and thereby reduce the chances of bugs.

    Cheers,
    Ovid

    New address of my CGI Course.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://341452]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (14)
As of 2014-07-10 21:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (216 votes), past polls