|XP is just a number|
Re^4: testing a standalone script with parametersby chexmix (Hermit)
|on Mar 04, 2009 at 20:44 UTC||Need Help??|
OK, I am still getting the same output (see below) and I think I am beginning to understand why ... so I hope my fellow Monks will excuse my ox-like progress ... :^)
In the script I am testing, what is now the sub main() calls out to a parse_opts() routine to set the values in %params. Therefore (if I am understanding this), the line I have added to myScript to enable testing, e.g.
... doesn't really make sense because the script isn't accessing @ARGV directly -- it is doing so via Getopt::Long and a parse_opts() routine. In other words there is kind of a collision of approaches here.
... so I am still lost in a way. Am not sure if I need to totally recast the script to be tested so that it doesn't make use of this form of parameter processing, or if there is still a way to do what I want, e.g. write a test that allows one to point the script at a particular file, read 'dummy' input and create 'dummy' output, and test that that is all being done correctly.
For what it is worth, this is what test_myScript.t looks like now:
... and here is the output:
I apologize for my utter fecklessness. I definitely need some more feck.