From: Junio C Hamano Date: Fri, 09 Dec 2011 18:43:42 GMT Subject: Re: [PATCH 3/6] t1006 (cat-file): use test_cmp Message-ID: <7v8vmlfuw1.fsf@alter.siamese.dyndns.org> In-Reply-To: <1323430158-14885-4-git-send-email-artagnon@gmail.com> Ramkumar Ramachandra writes: > In testing, a common paradigm involves checking the expected output > with the actual output: test-lib provides a test_cmp to show the diff > between the two outputs. So, use this function in preference to > calling a human over to compare command outputs by eye. > > Helped-by: Jonathan Nieder > Signed-off-by: Ramkumar Ramachandra > --- > t/t1006-cat-file.sh | 119 ++++++++++++++++++++++++--------------------------- > 1 files changed, 56 insertions(+), 63 deletions(-) > > diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh > index d8b7f2f..5be3ce9 100755 > --- a/t/t1006-cat-file.sh > +++ b/t/t1006-cat-file.sh > @@ -144,10 +119,13 @@ tag_size=$(strlen "$tag_content") > > run_tests 'tag' $tag_sha1 $tag_size "$tag_content" "$tag_pretty_content" 1 > > -test_expect_success \ > - "Reach a blob from a tag pointing to it" \ > - "test '$hello_content' = \"\$(git cat-file blob $tag_sha1)\"" > +test_expect_success "Reach a blob from a tag pointing to it" ' > + echo_without_newline "$hello_content" >expect && > + git cat-file blob "$tag_sha1" >actual && > + test_cmp expect actual > +' > > +test_done > for batch in batch batch-check > do > for opt in t s e p What is that test_done about?