git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Make test script annotate-tests.sh handle missing authors
@ 2010-10-16  5:50 Kevin Ballard
  2010-10-16  7:34 ` Jakub Narebski
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Ballard @ 2010-10-16  5:50 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Kevin Ballard

Initialize the %count hash to contain all the expected authors already.
This allows the script to print an error if an expected author was omitted
entirely from the blame/annotate output.

Signed-off-by: Kevin Ballard <kevin@sb.org>
---
I discovered this omission when trying to write a test for a change to
git-blame that I will be submitting shortly. Without this change, if an
author never showed up in the blame output, it would errneously consider
that to be ok. It still ignores authors that were never specified as
expected in the first place, but I wasn't so sure that was an error.

Also, I'm not a Perl programmer, so it's possible there's a better idiom
for this sort of thing.

 t/annotate-tests.sh |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh
index 396b965..4e37a66 100644
--- a/t/annotate-tests.sh
+++ b/t/annotate-tests.sh
@@ -9,6 +9,9 @@ check_count () {
 	cat .result | perl -e '
 		my %expect = (@ARGV);
 		my %count = ();
+		while (my ($author, $count) = each %expect) {
+			$count{$author} = 0;
+		}
 		while (<STDIN>) {
 			if (/^[0-9a-f]+\t\(([^\t]+)\t/) {
 				my $author = $1;
-- 
1.7.3.1.186.gc0af9.dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-10-16 13:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-16  5:50 [PATCH] Make test script annotate-tests.sh handle missing authors Kevin Ballard
2010-10-16  7:34 ` Jakub Narebski
2010-10-16 10:43   ` Kevin Ballard
2010-10-16 11:09     ` [PATCH v2] Update test script annotate-tests.sh to handle missing/extra authors Kevin Ballard
2010-10-16 12:22     ` [PATCH] Make test script annotate-tests.sh handle missing authors Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).