Subject: | make run_tests() more flexible (patch included) |
The patch below adds two arguments to run_tests().
First, passing a value for 'path' will let you specify the root of the
search tree, rather than always testing '.'
second, passing in a value for 'perltidyrc' will pass that value onto
Perl::Tidy so that you can override the default formatting directives
--- /Library/Perl/5.8.6/Test/PerlTidy.pm 2006-07-19
12:08:27.000000000 -0400
+++ t/Test/PerlTidy.pm 2006-07-19 12:25:53.000000000 -0400
@@ -29,19 +29,19 @@
$Test->skip_all("All tests skipped.") if $args{skip_all};
# Get files to work with and set the plan.
- my @files = list_files('.');
+ my @files = list_files( $args{path} || '.');
$Test->plan( tests => scalar @files );
# Check ech file in turn.
foreach my $file (@files) {
# $Test->diag("About to test '$file'\n");
- $Test->ok( is_file_tidy($file), "'$file'" );
+ $Test->ok( is_file_tidy($file, $args{perltidyrc} ), "'$file'" );
}
}
sub is_file_tidy {
- my $file_to_tidy = shift;
+ my( $file_to_tidy, $perltidyrc ) = @_;
my $code_to_tidy = load_file($file_to_tidy);
my $tidied_code = '';
@@ -55,6 +55,7 @@
stderr => \$stderr,
logfile => \$logfile,
errorfile => \$errorfile,
+ perltidyrc => $perltidyrc,
);
# If there were perltidy errors report them and return.