Hi,

I've been using Test::More and others for a few weeks now and trying to
code and test at the same time and it's great!  Thank you everyone for
the modules, docs and articles.

I am working with a bunch of scripts that need to run from cron, so they
redirect STDOUT and STDERR to files.  They all use a module I wrote to
encapsulate as much as possible, and I have test scripts that test the
general functionality of the module.

But, I'd also like to be able to embed tests in the actual scripts so
they test the specific functionality (e.g., this particular script can
do the particular things it needs to do), if I pass a certain command
line arg.  So far so good:

$ ./ftp_unc.pl TEST fmh_sch_call_list_05_18_2005.dat
1..7
ok 1 - new Tool created OK isa FMH::Tools
ok 2 - got data/fmh_sch_call_list_05_18_2005.dat via FTP
ok 3 - can connect to unc path
ok 4 - unc_put thinks it put 1 files
ok 5 - can stat new //blah/RPWIN20/DAILY FILE/today.txt
ok 6 - size of //blah/RPWIN20/DAILY FILE/today.txt matches size of
data/fmh_sch_call_list_05_18_2005.dat
ok 7 - cool.


But I can't get Test::More to be quiet (or write to the redirected
STDOUT/STDIN) when I don't supply the TEST argument:

$ ./ftp_unc.pl fmh_sch_call_list_05_18_2005.dat
1..7
# No tests run!


So I guess the problem is, Test::More produces output when I use() it,
but in some cases I'd like to not use() it, but I don't know whether I
want it until runtime and by then it's already been use()d...

I saw a thread about testing .pl scripts on the archive
(http://www.nntp.perl.org/group/perl.qa/3725) but it didn't quite match
what I'm trying to do.  Is there a better approach than the one I'm
using?

Thanks,
nathan

--
nathan vonnahme, system engineer at fairbanks memorial hospital
   1650 cowles street, fairbanks alaska 99701.  907-458-5464

Reply via email to