tests: use "test_cmp", not "diff", when verifying the result
In tests, call test_cmp rather than raw diff where possible (i.e. if
the output does not go to a pipe), to allow the use of, say, 'cmp'
when the default 'diff -u' is not compatible with a vendor diff.
When that is not possible, use $DIFF, as set in GIT-BUILD-OPTIONS.
Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Gary V. Vaughan15 years agocommitted byJunio C Hamano
@ -27,7 +27,7 @@ test_expect_success 'apply same filename with independent changes' '
@@ -27,7 +27,7 @@ test_expect_success 'apply same filename with independent changes' '
cp same_fn same_fn2 &&
git reset --hard &&
git apply patch0 &&
diff same_fn same_fn2
test_cmp same_fn same_fn2
'
test_expect_success 'apply same filename with overlapping changes' '
@ -40,7 +40,7 @@ test_expect_success 'apply same filename with overlapping changes' '
@@ -40,7 +40,7 @@ test_expect_success 'apply same filename with overlapping changes' '
cp same_fn same_fn2 &&
git reset --hard &&
git apply patch0 &&
diff same_fn same_fn2
test_cmp same_fn same_fn2
'
test_expect_success 'apply same new filename after rename' '
@ -54,7 +54,7 @@ test_expect_success 'apply same new filename after rename' '
@@ -54,7 +54,7 @@ test_expect_success 'apply same new filename after rename' '
cp new_fn new_fn2 &&
git reset --hard &&
git apply --index patch1 &&
diff new_fn new_fn2
test_cmp new_fn new_fn2
'
test_expect_success 'apply same old filename after rename -- should fail.' '
@ -280,7 +280,7 @@ test_expect_success 'updated working tree file should prevent the merge' '
@@ -280,7 +280,7 @@ test_expect_success 'updated working tree file should prevent the merge' '
echo "BAD: should have complained"
return 1
}
diff M M.saved || {
test_cmp M M.saved || {
echo "BAD: should have left M intact"
return 1
}
@ -301,7 +301,7 @@ test_expect_success 'updated working tree file should prevent the merge' '
@@ -301,7 +301,7 @@ test_expect_success 'updated working tree file should prevent the merge' '