Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: How to unit test a script packaged in a module distribution?

by samtregar (Abbot)
on Apr 27, 2007 at 19:21 UTC ( [id://612444]=note: print w/replies, xml ) Need Help??


in reply to How to unit test a script packaged in a module distribution?

You could abstract out the code in the script into a module with a single method call - i.e. run(). Then you could write tests which setup @ARGV and call run() to simulate running the script.

Alternately, you could make the script tests skip when they're running on Windows, but perhaps there are other OSes that can't easily execute scripts.

-sam

  • Comment on Re: How to unit test a script packaged in a module distribution?

Replies are listed 'Best First'.
Re^2: How to unit test a script packaged in a module distribution?
by vbar (Novice) on Apr 28, 2007 at 13:12 UTC

    Yes, I can assure you there's many OSes out there not executing my script :-/ - one thing I forgot was that a system can have more than one Perl interpreter...

    As for abstracting out the code, I guess it's possible, if I also changed all my print statements to accumulate the output instead, but I think it would be warping it too much. The module's experimental, after all - I need to think about what it should be doing before testing that it does...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-23 20:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found