>>Fergal Daly wrote: >> Hi, >> is it possible with Test::Harness and MakeMaker to pass arguments >> to my test scripts? I think it's not but I just want to check for sure. >> The module I'm working on is getting a new "optimised" mode so I'd like >> to be able to run all the tests twice, once with and once without the >> optimiser.
Create a sub class of Test::Harness and or MakeMaker that will over-ride all of their methods/subroutines and then add what you want it to do, don't forget to call super classes' method/subroutine that you are over-riding. I can give an example of this if need be. If you don't want to do that, you could build a wrapper class that will do the same thing without sub classing. There is also a module that will allow you to make use of command line arguments which I found to be useful that you might want to take a look at also Getopt::Std. I can also give an example of the use of Getopt::Std. >I have a similar problem; I'd like some of my test programs >to generate other test programs on the fly, then run them. >This seems to work: >use strict; >use Test::Harness; >my $outf = 'out.tmp'; >print "1..1\n"; >local *SAVOUT; open(SAVOUT, ">&STDOUT"); # save original STDOUT >open(STDOUT, '>'.$outf) or die "error: open '$outf': $!"; >my $success = runtests('t/some_generated_test.t'); >open(STDOUT, ">&SAVOUT"); # restore STDOUT >$success or print "not "; >print "ok 1\n"; >but I feel odd. Or should I generate them in Makefile.PL? >Does anyone know of a CPAN module that generates its test programs? If anyone knows of one could they tell me too? >More generally, which CPAN modules have particularly good test >suites, worthy of study? Take a look at Test::More and Test::Simple --------------------------------------------------- Andrew Potozniak Administrative Computing Student Assistant State University of New York at Buffalo [EMAIL PROTECTED] 645-3587 x 7123 ---------------------------------------------------