Commit 99fc60c2f4 for perl
commit 99fc60c2f4eccdbcd76c1a2537a291098a65791a
Author: James E Keenan <jamesekeenan@yahoo.com>
Date: Fri Oct 9 09:06:40 2026 -0400
_compute_tests_and_ordering: Improve encapsulation
%total_time was used only within _compute_tests_and_ordering() and
sort_by_execution_order. The latter, in turn, was/is only called within
_compute_tests_and_ordering(). Bring declaration of %total_time inside
_compute_tests_and_ordering(). Transform sort_by_execution_order()
into a lexical sub declared within _compute_tests_and_ordering().
diff --git a/t/harness b/t/harness
index baff12ab58..4cbccd1416 100644
--- a/t/harness
+++ b/t/harness
@@ -126,8 +126,12 @@ if ($ENV{HARNESS_OPTIONS}) {
$jobs ||= 1;
-my %total_time;
sub _compute_tests_and_ordering($) {
+ my %total_time;
+ my sub sort_by_execution_order {
+ # Directories, ordered by total time descending then name ascending
+ return $total_time{$b} <=> $total_time{$a} || lc $a cmp lc $b;
+ }
my @tests = $_[0]->@*;
my %dir;
@@ -308,11 +312,6 @@ sub _compute_tests_and_ordering($) {
return \@seq;
}
-sub sort_by_execution_order {
- # Directories, ordered by total time descending then name ascending
- return $total_time{$b} <=> $total_time{$a} || lc $a cmp lc $b;
-}
-
my @tests = ();
if (@ARGV) {
# If you want these run in speed order, just use prove