diff options
author | Karl Williamson <khw@cpan.org> | 2022-12-12 21:38:52 -0700 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2022-12-18 18:56:09 +0100 |
commit | c7f8bf87c7839fa664afa2b32be8f44b499b0763 (patch) | |
tree | 0ba4bda7e70ee0da2bf5126e8b391575b49b1b3f /t | |
parent | 8bb94d74fa4c2d935e37956ea7d2c837d7c91d42 (diff) | |
download | perl-c7f8bf87c7839fa664afa2b32be8f44b499b0763.tar.gz |
harness: Assign names to $_
These are clearer to read, espectially in largish loops.
Diffstat (limited to 't')
-rw-r--r-- | t/harness | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -180,18 +180,18 @@ if (@ARGV) { my %all_dirs; # Preprocess the list of tests - for (@last) { + for my $file (@last) { if ($^O eq 'MSWin32') { - s,\\,/,g; # canonicalize path + $file =~ s,\\,/,g; # canonicalize path }; # Keep a list of the distinct directory names, and another list of # those which contain a file whose name begins with a 0 - if ( m! \A (?: \.\. / )? + if ($file =~ m! \A (?: \.\. / )? ( .*? ) # $1 is the directory path name - / + / ( [^/]* \. (?: t | pl ) ) # $2 is the test name - \z !x) + \z !x) { my $path = $1; my $name = $2; @@ -224,17 +224,17 @@ if (@ARGV) { undef %all_dirs; undef %serials; - for (@last) { + for my $file (@last) { # Treat every file in each non-serial directory as its own # "directory", so that it can be executed in parallel - m! \A ( (?: \.\. / )? (?: $non_serials ) + $file =~ m! \A ( (?: \.\. / )? (?: $non_serials ) / [^/]+ \.t \z | .* [/] ) !x - or die "'$_'"; - push @{$dir{$1}}, $_; + or die "'$file'"; + push @{$dir{$1}}, $file; # This file contributes time to the total needed for the directory # as a whole - $total_time{$1} += $times{$_} || 0; + $total_time{$1} += $times{$file} || 0; } #print STDERR __LINE__, join "\n", sort sort_by_execution_order keys %dir |