Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

by perrin (Chancellor)
on Mar 31, 2004 at 21:54 UTC ( #341438=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)

But most of the redundancy of the tests is actually encapsulated in functions

That sounds fine then.

I do have to disagree that can is not "really calling the interface to my class" though.

It isn't calling the interface. It is calling the can() method which is typically inherited from UNIVERSAL::can(). This will break if you do any sneaky AUTOLOAD stuff. (Sure, you could fix that, but what a waste of time.) It's better to actually call the method you are checking instead.

I suppose that just testing that they are there (can_ok) is good enough. Do you agree?

Yes, for constants. I think it's better to use globals than the subs that the constant pragma creates, but that's a whole other discussion.

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

Replies are listed 'Best First'.
Re: Re: Re: Re: Testaholics Anonymous (or how I learned to stop worrying and love Test::More)
by chromatic (Archbishop) on Apr 01, 2004 at 01:41 UTC

    At the risk of tempting tilly into posting a top-level meditation in the subject, I disagree that can() is too tricky to get right.

    Granted, many people get it wrong, but the solution is well documented.

    I prefer to test my subs and methods with can_ok() because I prefer the way it documents failure, if things fail. It's also very handy to test exporting, if that's your style.

Re: 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:49 UTC
    This will break if you do any sneaky AUTOLOAD stuff.

    Personally I avoid that stuff like the plague, so it wouldn't be an issue in this particular code base. But i see what you are saying.

    -stvn

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://341438]
help
Chatterbox?
[stevieb]: I found that win10 broke a C# library I was using for one project while enhancing tests for a Perl dist, which breaks other Perl dists, and I'm about to throw my hands up on berrybrew. win2k12 broke one thing, win10 breaks something...
[stevieb]: ...unrelated which requires replacing a lot of code and a whole lib. I'm about to go nix only ffs
[shmem]: stevieb: what you're doing sounds afwully complex. Too much for me this evening to provide brighter insight ;-)
[stevieb]: I don't even own a Windows computer. Both my girl and I have a laptop each with Linux. I'm supporting Windows in some of my projects and I can't even guage whether it's worth it or not.
[stevieb]: shmem It's something I desired to have years ago, which is why I took over berrybrew. Cross-platform build/test automation locally, or over the network Test::BrewBuild
[shmem]: sounds good.
[shmem]: but I'm crumbling smaller stones. remember...
[stevieb]: I'm working on it to fatten it up and make it more reliant so I can finalize my Raspberry Pi automated build system for that software :) It's all well and fun, until I try to make it work with Windows lol
[shmem]: "debugging a program is more difficult than to write it in the first place. If you code your program as smart as you are, you are, by definition, too dumb to debug it."

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2017-03-28 22:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (342 votes). Check out past polls.