Skip to content

Commit 6016bef

Browse files
committed
Improve readability of code imported from failed-tests-printer.pl
1 parent dd6e431 commit 6016bef

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

regression/test.pl

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -382,16 +382,18 @@ ($)
382382
my $output_file = "";
383383
my $descriptor_file = "";
384384

385-
while (<LOG>) {
386-
chomp;
387-
if (/^Test '(.+)'/) {
385+
while (my $line = <LOG>) {
386+
chomp $line;
387+
if ($line =~ /^Test '(.+)'/) {
388388
$current_test = $1;
389389
$printed_this_test = 0;
390-
} elsif (/Descriptor:\s+([^\s]+)/) {
390+
} elsif ($line =~ /Descriptor:\s+([^\s]+)/) {
391391
$descriptor_file = $1;
392-
} elsif (/Output:\s+([^\s]+)/) {
392+
} elsif ($line =~ /Output:\s+([^\s]+)/) {
393393
$output_file = $1;
394-
} elsif (/\[FAILED\]\s*$/) {
394+
} elsif ($line =~ /\[FAILED\]\s*$/) {
395+
# print a descriptive header before dumping the test.desc lines that
396+
# actually weren't matched (and print this header just once)
395397
if(0 == $printed_this_test) {
396398
$printed_this_test = 1;
397399
print "\n\n";
@@ -403,7 +405,8 @@ ($)
403405
close FH;
404406
print "\n\nFailed $descriptor_file lines:\n";
405407
}
406-
print "$_\n";
408+
409+
print "$line\n";
407410
}
408411
}
409412
}

0 commit comments

Comments
 (0)