aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ballard <kevin@sb.org>2010-10-16 04:09:20 -0700
committerJunio C Hamano <gitster@pobox.com>2010-10-19 14:15:30 -0700
commit27eea66b28e15890ae587303c1c316388845169e (patch)
tree7788b127b9b9d719abc608af422abaf9e65a2356
parent352953a556e7f8d720e26a32d4aabbf823d3c4d4 (diff)
downloadgit-27eea66b28e15890ae587303c1c316388845169e.tar.gz
git-27eea66b28e15890ae587303c1c316388845169e.tar.xz
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 <jnareb@gmail.com> Signed-off-by: Kevin Ballard <kevin@sb.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--t/annotate-tests.sh12
1 files changed, 6 insertions, 6 deletions
diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh
index 396b9653a..141b60cdc 100644
--- a/t/annotate-tests.sh
+++ b/t/annotate-tests.sh
@@ -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);
' "$@"