Skip to content

Commit

Permalink
Update test script annotate-tests.sh to handle missing/extra authors
Browse files Browse the repository at this point in the history
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 <jnareb@gmail.com>
Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Kevin Ballard authored and Junio C Hamano committed Oct 19, 2010
1 parent 352953a commit 27eea66
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions t/annotate-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ check_count () {
$PROG file $head >.result || return 1
cat .result | perl -e '
my %expect = (@ARGV);
my %count = ();
my %count = map { $_ => 0 } keys %expect;
while (<STDIN>) {
if (/^[0-9a-f]+\t\(([^\t]+)\t/) {
my $author = $1;
for ($author) { s/^\s*//; s/\s*$//; }
if (exists $expect{$author}) {
$count{$author}++;
}
$count{$author}++;
}
}
my $bad = 0;
while (my ($author, $count) = each %count) {
my $ok;
if ($expect{$author} != $count) {
my $value = 0;
$value = $expect{$author} if defined $expect{$author};
if ($value != $count) {
$bad = 1;
$ok = "bad";
}
else {
$ok = "good";
}
print STDERR "Author $author (expected $expect{$author}, attributed $count) $ok\n";
print STDERR "Author $author (expected $value, attributed $count) $ok\n";
}
exit($bad);
' "$@"
Expand Down

0 comments on commit 27eea66

Please sign in to comment.