summaryrefslogtreecommitdiff
path: root/t/t7502-commit.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2008-03-12 21:36:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-03-13 07:57:52 (GMT)
commit82ebb0b6ec7470cab96a013d3d719c109003ef83 (patch)
tree8796598a518e972881afd729215c265924c04ddf /t/t7502-commit.sh
parentb4ce54fc61e7c76e2d7f47c34733f0f0bbb6c4cd (diff)
downloadgit-82ebb0b6ec7470cab96a013d3d719c109003ef83.zip
git-82ebb0b6ec7470cab96a013d3d719c109003ef83.tar.gz
git-82ebb0b6ec7470cab96a013d3d719c109003ef83.tar.bz2
add test_cmp function for test scripts
Many scripts compare actual and expected output using "diff -u". This is nicer than "cmp" because the output shows how the two differ. However, not all versions of diff understand -u, leading to unnecessary test failure. This adds a test_cmp function to the test scripts and switches all "diff -u" invocations to use it. The function uses the contents of "$GIT_TEST_CMP" to compare its arguments; the default is "diff -u". On systems with a less-capable diff, you can do: GIT_TEST_CMP=cmp make test Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7502-commit.sh')
-rwxr-xr-xt/t7502-commit.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh
index b780fdd..284c941 100755
--- a/t/t7502-commit.sh
+++ b/t/t7502-commit.sh
@@ -85,7 +85,7 @@ test_expect_success 'verbose' '
git add negative &&
git status -v | sed -ne "/^diff --git /p" >actual &&
echo "diff --git a/negative b/negative" >expect &&
- diff -u expect actual
+ test_cmp expect actual
'
@@ -95,7 +95,7 @@ test_expect_success 'cleanup commit messages (verbatim,-t)' '
{ echo;echo "# text";echo; } >expect &&
git commit --cleanup=verbatim -t expect -a &&
git cat-file -p HEAD |sed -e "1,/^\$/d" |head -n 3 >actual &&
- diff -u expect actual
+ test_cmp expect actual
'
@@ -104,7 +104,7 @@ test_expect_success 'cleanup commit messages (verbatim,-F)' '
echo >>negative &&
git commit --cleanup=verbatim -F expect -a &&
git cat-file -p HEAD |sed -e "1,/^\$/d">actual &&
- diff -u expect actual
+ test_cmp expect actual
'
@@ -113,7 +113,7 @@ test_expect_success 'cleanup commit messages (verbatim,-m)' '
echo >>negative &&
git commit --cleanup=verbatim -m "$(cat expect)" -a &&
git cat-file -p HEAD |sed -e "1,/^\$/d">actual &&
- diff -u expect actual
+ test_cmp expect actual
'
@@ -124,7 +124,7 @@ test_expect_success 'cleanup commit messages (whitespace,-F)' '
echo "# text" >expect &&
git commit --cleanup=whitespace -F text -a &&
git cat-file -p HEAD |sed -e "1,/^\$/d">actual &&
- diff -u expect actual
+ test_cmp expect actual
'
@@ -135,7 +135,7 @@ test_expect_success 'cleanup commit messages (strip,-F)' '
echo sample >expect &&
git commit --cleanup=strip -F text -a &&
git cat-file -p HEAD |sed -e "1,/^\$/d">actual &&
- diff -u expect actual
+ test_cmp expect actual
'
@@ -150,7 +150,7 @@ test_expect_success 'cleanup commit messages (strip,-F,-e)' '
{ echo;echo sample;echo; } >text &&
git commit -e -F text -a &&
head -n 4 .git/COMMIT_EDITMSG >actual &&
- diff -u expect actual
+ test_cmp expect actual
'