Skip to content

Commit

Permalink
Item9853: perltidy
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/branches/Release01x01@9650 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
OlivierRaginel authored and OlivierRaginel committed Oct 20, 2010
1 parent 065980c commit 8afb87c
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions UnitTestContrib/lib/Unit/TestRunner.pm
Expand Up @@ -16,7 +16,8 @@ use Devel::Symdump;
use Error qw(:try);
use File::Spec;

sub CHECKLEAK {0}
sub CHECKLEAK { 0 }

BEGIN {
if (CHECKLEAK) {
eval "use Devel::Leak::Object qw{ GLOBAL_bless };";
Expand Down Expand Up @@ -136,11 +137,11 @@ sub start {
$action = runOne( $tester, $suite, $testToRun );
}

if ( Cwd->cwd() ne $start_cwd) {
print "CWD changed to " . Cwd->cwd()
. " by previous test!! \n";
chdir $start_cwd or die "Cannot change back to previous $start_cwd\n";
}
if ( Cwd->cwd() ne $start_cwd ) {
print "CWD changed to " . Cwd->cwd() . " by previous test!! \n";
chdir $start_cwd
or die "Cannot change back to previous $start_cwd\n";
}

# untaint action for the case where the test is run in
# another process
Expand Down Expand Up @@ -201,28 +202,28 @@ sub runOneInNewProcess {

my @paths;
push( @paths, "-I", $_ ) for ( @unshiftedOntoINC, @pushedOntoINC );
my @command = map
{
my $value = $_;
if (defined $value) {
$value =~ /(.*)/;
$value = $1; # untaint
}
$value;
my @command = map {
my $value = $_;
if ( defined $value ) {
$value =~ /(.*)/;
$value = $1; # untaint
}
($^X, "-wT", @paths, File::Spec->rel2abs($0), "-worker", $suite, ,$testToRun, $tempfilename);
my $command = join(' ', @command);
$value;
} (
$^X, "-wT", @paths, File::Spec->rel2abs($0),
"-worker", $suite,, $testToRun, $tempfilename
);
my $command = join( ' ', @command );
print "Running: $command\n";

$ENV{PATH} =~ /(.*)/;
$ENV{PATH} = $1; # untaint
$ENV{PATH} = $1; # untaint
system(@command);
if ( $? == -1 ) {
my $error = $!;
unlink $tempfilename;
print "*** Could not spawn new process for $suite: $error\n";
return
'push( @{ $this->{failures} }, "'
return 'push( @{ $this->{failures} }, "'
. $suite . '\n'
. quotemeta($error) . '" );';
}
Expand All @@ -231,8 +232,7 @@ sub runOneInNewProcess {
if ($returnCode) {
print "*** Error trying to run $suite\n";
unlink $tempfilename;
return
'push( @{ $this->{failures} }, "Process for '
return 'push( @{ $this->{failures} }, "Process for '
. $suite
. ' returned '
. $returnCode . '" );';
Expand All @@ -255,11 +255,12 @@ sub runOneInNewProcess {
sub worker {
my $numArgs = scalar(@_);
my ( $this, $testSuiteModule, $testToRun, $tempfilename ) = @_;
if ($numArgs != 4 or
not defined $this or
not defined $testSuiteModule or
not defined $testToRun or
not defined $tempfilename ) {
if ( $numArgs != 4
or not defined $this
or not defined $testSuiteModule
or not defined $testToRun
or not defined $tempfilename )
{
my $pkg = __PACKAGE__;
die <<"DIE";
Expand All @@ -274,15 +275,14 @@ DIE
$testToRun = undef;
}
else {
$testToRun =~ /(.*)/; # untaint
$testToRun =~ /(.*)/; # untaint
$testToRun = $1;
}

$testSuiteModule =~ /(.*)/; # untaint
$testSuiteModule =~ /(.*)/; # untaint
$testSuiteModule = $1;


$tempfilename =~ /(.*)/; # untaint
$tempfilename =~ /(.*)/; # untaint
$tempfilename = $1;

my $suite = $testSuiteModule;
Expand Down Expand Up @@ -355,16 +355,16 @@ sub runOne {
if ($testToRun) {
my @runTests = grep { /^${suite}::$testToRun$/ } @tests;
if ( !@runTests ) {
@runTests = grep { /^${suite}::$testToRun/ } @tests;
@runTests = grep { /^${suite}::$testToRun/ } @tests;
if ( !@runTests ) {
print "*** No test matching $testToRun in $suite\n";
print join("\n", "\t$suite contains:", @tests, '');
print join( "\n", "\t$suite contains:", @tests, '' );
return $action;
}
else {
print "*** Running "
. @runTests
. " tests matching your pattern ($testToRun)\n"
. @runTests
. " tests matching your pattern ($testToRun)\n";
}
}
@tests = @runTests;
Expand Down

0 comments on commit 8afb87c

Please sign in to comment.