the attached patch allows you to call Apache::TestMM::generate_script() with no arguments, which creates a minimal (but sufficient for most purposes) t/TEST script. when passed an argument it works as before.
--Geoff
Index: lib/Apache/TestMM.pm
===================================================================
RCS file: /home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/TestMM.pm,v
retrieving revision 1.24
diff -u -r1.24 TestMM.pm
--- lib/Apache/TestMM.pm 27 Mar 2003 07:57:06 -0000 1.24
+++ lib/Apache/TestMM.pm 1 Apr 2003 18:09:37 -0000
@@ -7,6 +7,8 @@
use Apache::TestConfig ();
use Apache::TestTrace;
+use File::Spec::Functions qw(catfile);
+
sub import {
my $class = shift;
@@ -70,7 +72,7 @@
sub generate_script {
my $file = shift;
- unlink $file if -e $file;
+ unlink $file if $file && -e $file;
my $body = Apache::TestConfig->modperl_2_inc_fixup;
@@ -78,13 +80,30 @@
$body .= "\%Apache::TestConfig::Argv = qw(@Apache::TestMM::Argv);\n";
}
- my $in = Symbol::gensym();
- open $in, "$file.PL" or die "Couldn't open $file.PL: $!";
- {
- local $/;
- $body .= <$in>;
+ if ($file) {
+ # target script specified
+
+ my $in = Symbol::gensym();
+ open $in, "$file.PL" or die "Couldn't open $file.PL: $!";
+ {
+ local $/;
+ $body .= <$in>;
+ }
+ close $in;
+ }
+ else {
+ # no script specified - generate a default t/TEST
+ $file = catfile(qw(t TEST));
+
+ $body .= <<'EOF';
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::TestRunPerl ();
+
+Apache::TestRunPerl->new->run(@ARGV);
+EOF
}
- close $in;
info "generating script $file";
Apache::Test::config()->write_perlscript($file, $body);--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
