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

[PATCH] t/t7500-commit.sh: use test_cmp instead of test

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Feb 19, 2011, 18:29 UTC
Message-ID
<1298140149-13652-1-git-send-email-avarab@gmail.com>

Change commit_msg_is() in t/t7500-commit.sh to use test_cmp instead of the shell's test function. Now if a test fails we'll get test_cmp output showing us what failed.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t7500-commit.sh |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh
index 162527c..d551b77 100755
--- a/t/t7500-commit.sh
+++ b/t/t7500-commit.sh
@@ -10,7 +10,12 @@ Tests for selected commit options.'
 . ./test-lib.sh
 
 commit_msg_is () {
-	test "`git log --pretty=format:%s%b -1`" = "$1"
+	expect=commit_msg_is.expect
+	actual=commit_msg_is.actual
+
+	printf "%s" "$(git log --pretty=format:%s%b -1)" >$expect &&
+	printf "%s" "$1" >$actual &&
+	test_cmp $expect $actual
 }
 
 # A sanity check to see if commit is working at all.
-- 
1.7.2.3
Message 1 of 1 in “t/t7500-commit.sh: use test_cmp instead of test”
  1. t/t7500-commit.sh: use test_cmp instead of testÆvar Arnfjörð Bjarmason, Feb 19, 2011

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.