From 82ebb0b6ec7470cab96a013d3d719c109003ef83 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 12 Mar 2008 17:36:36 -0400 Subject: 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 Signed-off-by: Junio C Hamano --- t/t3701-add-interactive.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't/t3701-add-interactive.sh') diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh index c8dc1ac24..77c90f6fa 100755 --- a/t/t3701-add-interactive.sh +++ b/t/t3701-add-interactive.sh @@ -24,7 +24,7 @@ EOF test_expect_success 'diff works (initial)' ' (echo d; echo 1) | git add -i >output && sed -ne "/new file/,/content/p" diff && - diff -u expected diff + test_cmp expected diff ' test_expect_success 'revert works (initial)' ' git add file && @@ -57,7 +57,7 @@ EOF test_expect_success 'diff works (commit)' ' (echo d; echo 1) | git add -i >output && sed -ne "/^index/,/content/p" diff && - diff -u expected diff + test_cmp expected diff ' test_expect_success 'revert works (commit)' ' git add file && -- cgit v1.2.1