Skip to content

Commit 27eea66

Browse files
lilyballgitster
authored andcommitted
Update test script annotate-tests.sh to handle missing/extra authors
The current script used by annotate-tests.sh (used by t8001 and t8002) fails to emit a warning if any of the expected authors never show up in the output or if authors that show up in the output were never specified as expected. Update the script to fail in both of these scenarios. Helped-by: Jakub Narebski <[email protected]> Signed-off-by: Kevin Ballard <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 352953a commit 27eea66

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

t/annotate-tests.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@ check_count () {
88
$PROG file $head >.result || return 1
99
cat .result | perl -e '
1010
my %expect = (@ARGV);
11-
my %count = ();
11+
my %count = map { $_ => 0 } keys %expect;
1212
while (<STDIN>) {
1313
if (/^[0-9a-f]+\t\(([^\t]+)\t/) {
1414
my $author = $1;
1515
for ($author) { s/^\s*//; s/\s*$//; }
16-
if (exists $expect{$author}) {
17-
$count{$author}++;
18-
}
16+
$count{$author}++;
1917
}
2018
}
2119
my $bad = 0;
2220
while (my ($author, $count) = each %count) {
2321
my $ok;
24-
if ($expect{$author} != $count) {
22+
my $value = 0;
23+
$value = $expect{$author} if defined $expect{$author};
24+
if ($value != $count) {
2525
$bad = 1;
2626
$ok = "bad";
2727
}
2828
else {
2929
$ok = "good";
3030
}
31-
print STDERR "Author $author (expected $expect{$author}, attributed $count) $ok\n";
31+
print STDERR "Author $author (expected $value, attributed $count) $ok\n";
3232
}
3333
exit($bad);
3434
' "$@"

0 commit comments

Comments
 (0)