diff options
author | zach%zachlipton.com <> | 2002-05-09 06:49:31 +0000 |
---|---|---|
committer | zach%zachlipton.com <> | 2002-05-09 06:49:31 +0000 |
commit | ccf9d404cfe99346af2f08dbbda44a3a53912b90 (patch) | |
tree | e8d3de7e241b998d8dc5498852873938632316b9 /t/003safesys.t | |
parent | 1d10fae35ea91b2e038cc8d3942a1860415e5dde (diff) | |
download | bugs-ccf9d404cfe99346af2f08dbbda44a3a53912b90.tar bugs-ccf9d404cfe99346af2f08dbbda44a3a53912b90.tar.gz bugs-ccf9d404cfe99346af2f08dbbda44a3a53912b90.tar.bz2 bugs-ccf9d404cfe99346af2f08dbbda44a3a53912b90.tar.xz bugs-ccf9d404cfe99346af2f08dbbda44a3a53912b90.zip |
Fix for bug 143124, Fix warning messages about *::TESTOUT and clean up
test code. Patch makes the tests much better now.
r=zach x2
Diffstat (limited to 't/003safesys.t')
-rw-r--r-- | t/003safesys.t | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/t/003safesys.t b/t/003safesys.t index 98e9d2d64..14de7c030 100644 --- a/t/003safesys.t +++ b/t/003safesys.t @@ -36,29 +36,42 @@ #Bugzilla Test 3# ###Safesystem#### -BEGIN { use lib 't/'; } -BEGIN { use Support::Files; } -BEGIN { $tests = @Support::Files::testitems; } -BEGIN { use Test::More tests => $tests; } - use strict; +use lib 't'; + +use Support::Files; + +use Test::More tests => scalar(@Support::Files::testitems); + +# Capture the TESTOUT from Test::More or Test::Builder for printing errors. +# This will handle verbosity for us automatically. +my $fh; +{ + local $^W = 0; # Don't complain about non-existent filehandles + if (-e \*Test::More::TESTOUT) { + $fh = \*Test::More::TESTOUT; + } elsif (-e \*Test::Builder::TESTOUT) { + $fh = \*Test::Builder::TESTOUT; + } else { + $fh = \*STDOUT; + } +} + my @testitems = @Support::Files::testitems; -# Capture the TESTERR from Test::More for printing errors. -# This will handle verbosity for us automatically -*TESTOUT = \*Test::More::TESTOUT; my $perlapp = $^X; foreach my $file (@testitems) { - $file =~ s/\s.*$//; # nuke everything after the first space (#comment) - next if (!$file); # skip null entries - my $command = "$perlapp -c -It -MSupport::Systemexec $file 2>&1"; - my $loginfo=`$command`; - if ($loginfo =~ /arguments for Support::Systemexec::(system|exec)/im) { - ok(0,"$file DOES NOT use proper system or exec calls"); - print TESTOUT $loginfo; - } else { - ok(1,"$file uses proper system and exec calls"); - } + $file =~ s/\s.*$//; # nuke everything after the first space (#comment) + next if (!$file); # skip null entries + my $command = "$perlapp -c -It -MSupport::Systemexec $file 2>&1"; + my $loginfo=`$command`; + if ($loginfo =~ /arguments for Support::Systemexec::(system|exec)/im) { + ok(0,"$file DOES NOT use proper system or exec calls"); + print $fh $loginfo; + } else { + ok(1,"$file uses proper system and exec calls"); + } } +exit 0; |