-sub _find_tests {
- my($dir) = @_;
- opendir DIR, $dir or die "Trouble opening $dir: $!";
- foreach my $f (sort { $a cmp $b } readdir DIR) {
- next if $skip{$f};
-
- my $fullpath = "$dir/$f";
-
- if (-d $fullpath) {
- _find_tests($fullpath);
- } elsif ($f =~ /\.t$/) {
- push @ARGV, $fullpath;
+sub _find_tests { our @found=(); push @ARGV, _find_files('\.t$', $_[0]) }
+sub _find_files {
+ my($patt, @dirs) = @_;
+ for my $dir (@dirs) {
+ opendir DIR, $dir or die "Trouble opening $dir: $!";
+ foreach my $f (sort { $a cmp $b } readdir DIR) {
+ next if $skip{$f};
+
+ my $fullpath = "$dir/$f";
+
+ if (-d $fullpath) {
+ _find_files($patt, $fullpath);
+ } elsif ($f =~ /$patt/) {
+ push @found, $fullpath;
+ }