Commits

Palmer, 2E0EOL committed 5666ba0 Draft Merge

Merge heads

  • Participants
  • Parent commits 8e62d87, 8ebb2c7
  • Branches develop

Comments (0)

Files changed (1)

File t/check_disks_zpool.t

 
 	my $testdir = 'testdata/check_disks_zpool';
 	if ( opendir(my $d, $testdir) ) {
-		my @dentries = ( );
+		my ( %dentries, %dentries_codes );
 		while ( my $ent = readdir($d) ) {
+			my $filename = "$testdir/$ent";
 			next if ( $ent =~ m/^\./ );
-			push(@dentries, $ent);
+			if ( $ent =~ m/^(\d{1,2})\_(\w+)\.txt$/ ) {
+				$dentries{$1} = $ent;
+				$dentries_codes{$1} = $fn_ec_map{$2};
+				next;
+			}
+			warn "Not running unit test $ent";
 		}
 		closedir($d);
 
-		foreach my $ent ( sort { $a <=> $b } (@dentries) ) {
-			if ( $ent =~ m/^(\d{1,2})\_(\w+)\.txt$/ ) {
-				my $filename = "$testdir/$ent";
-				my $expect_exit = $fn_ec_map{$2};
-				if ( !defined($expect_exit) ) {
-					warn "Not running unit test (unknown filename): $ent";
-					next;
-				}
-				is(main(q => 1, f => $filename), $expect_exit, "$filename exits $expect_exit");
-			} else {
-				warn "Not running unit test $ent";
+		foreach my $testn ( sort { $a <=> $b } ( keys(%dentries) ) ) {
+			my $ent = $dentries{$testn};
+			my $filename = "$testdir/$ent";
+			my $expect_exit = $dentries_codes{$testn};
+			if ( !defined($expect_exit) ) {
+				warn "Not running unit test (unknown filename): $ent";
+				next;
 			}
+
+			is(main(q => 1, f => $filename), $expect_exit, "$filename exits $expect_exit");
 		}
 	}
 	return 0;