Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^6: Universal test flag

by zwon (Abbot)
on Jul 19, 2012 at 13:29 UTC ( #982630=note: print w/replies, xml ) Need Help??


in reply to Re^5: Universal test flag
in thread Universal test flag

to actually be able to refactor you must first have a solid set of tests

And the exact problem with what you are trying to do is that it isn't solid. Suppose later you extract SMS sending code into a separate module, will your tests help you to find if you broke anything? No, because the code that may be broken by the change is being skipped in the test mode.

So what I would do, is to write solid test, and refactor code to pass it.

Replies are listed 'Best First'.
Re^7: Universal test flag
by ait (Friar) on Jul 19, 2012 at 19:00 UTC

    I think we are talking about two different things here. I understand what you are saying but this is not the case that the SMS code is inside the function and later factored out (in fact the SMS part was a made-up example to illustrate). I'm talking about the the case where the sub you are testing calls something else and you want to skip that, the same way you may skip tests in your test harness.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://982630]
help
Chatterbox?
[1nickt]: Gotya.
[LanX]: hmm reviews have no vote button?
[1nickt]: I use many books for purposes other than that for which they were written: decoration, paperweight, coffee mug coaster on the good table ...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2017-11-17 21:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (274 votes). Check out past polls.

    Notices?