git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] t7501: always use test_cmp instead of diff

From
Miklos Vajna <vmiklos@frugalware.org>
Date
Sep 10, 2008, 17:32 UTC
Message-ID
<1221067964-12287-1-git-send-email-vmiklos@frugalware.org>
In-Reply-To
<7vljy03m2m.fsf@gitster.siamese.dyndns.org>

This should make the output more readable (by default using diff -u) when some tests fail.

Also changed the diff order from "current expected" to "expected current".

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
On Tue, Sep 09, 2008 at 05:02:09PM -0700, Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
> > We seem to use the convention of
> >
> >   test_cmp <expected> <actual>
> >
> > elsewhere, rather than
> >
> >   test_cmp <actual> <expected>
> >
> > as you have here.  Most noticeably, that means the diff will show
> > deviations from expected, rather "what should be done to make this
> > as expected".
>
> Yes, please.
Here is an updated patch that does this as well.
 t/t7501-commit.sh |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index 469bff8..63bfc6d 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -141,7 +141,7 @@ EOF
 
 test_expect_success \
     'validate git rev-list output.' \
-    'diff current expected'
+    'test_cmp expected current'
 
 test_expect_success 'partial commit that involves removal (1)' '
 
@@ -151,7 +151,7 @@ test_expect_success 'partial commit that involves removal (1)' '
 	git commit -m "Partial: add elif" elif &&
 	git diff-tree --name-status HEAD^ HEAD >current &&
 	echo "A	elif" >expected &&
-	diff expected current
+	test_cmp expected current
 
 '
 
@@ -160,7 +160,7 @@ test_expect_success 'partial commit that involves removal (2)' '
 	git commit -m "Partial: remove file" file &&
 	git diff-tree --name-status HEAD^ HEAD >current &&
 	echo "D	file" >expected &&
-	diff expected current
+	test_cmp expected current
 
 '
 
@@ -171,7 +171,7 @@ test_expect_success 'partial commit that involves removal (3)' '
 	git commit -m "Partial: modify elif" elif &&
 	git diff-tree --name-status HEAD^ HEAD >current &&
 	echo "M	elif" >expected &&
-	diff expected current
+	test_cmp expected current
 
 '
 
@@ -187,7 +187,7 @@ test_expect_success 'amend commit to fix author' '
 		expected &&
 	git commit --amend --author="$author" &&
 	git cat-file -p HEAD > current &&
-	diff expected current
+	test_cmp expected current
 
 '
 
@@ -256,7 +256,7 @@ test_expect_success 'amend commit to fix author' '
 		expected &&
 	git commit --amend --author="$author" &&
 	git cat-file -p HEAD > current &&
-	diff expected current
+	test_cmp expected current
 
 '
 
-- 
1.6.0.1
Previous: Junio C Hamano
Message 5 of 5 in “t7501: always use test_cmp instead of diff”
  1. t7501: always use test_cmp instead of diffMiklos Vajna, Sep 9, 2008
  2. Miklos VajnaSep 9, 2008
  3. Jeff KingSep 9, 2008
  4. Junio C HamanoSep 10, 2008
  5. t7501: always use test_cmp instead of diffMiklos Vajna, Sep 10, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.