Merge branch 'es/test-cmp-typocatcher'

A test helper "test_cmp A B" was taught to diagnose missing files A
or B as a bug in test, but some tests legitimately wanted to notice
a failure to even create file B as an error, in addition to leaving
the expected result in it, and were misdiagnosed as a bug.  This
has been corrected.

* es/test-cmp-typocatcher:
  Revert "test_cmp: diagnose incorrect arguments"
This commit is contained in:
Junio C Hamano 2020-11-02 13:17:38 -08:00
commit d5c2d1a0aa

View File

@ -952,13 +952,7 @@ test_expect_code () {
# - not all diff versions understand "-u" # - not all diff versions understand "-u"
test_cmp() { test_cmp() {
test $# -eq 2 || BUG "test_cmp requires two arguments" eval "$GIT_TEST_CMP" '"$@"'
if ! eval "$GIT_TEST_CMP" '"$@"'
then
test "x$1" = x- || test -e "$1" || BUG "test_cmp '$1' missing"
test "x$2" = x- || test -e "$2" || BUG "test_cmp '$2' missing"
return 1
fi
} }
# Check that the given config key has the expected value. # Check that the given config key has the expected value.
@ -987,13 +981,7 @@ test_cmp_config() {
# test_cmp_bin - helper to compare binary files # test_cmp_bin - helper to compare binary files
test_cmp_bin() { test_cmp_bin() {
test $# -eq 2 || BUG "test_cmp_bin requires two arguments" cmp "$@"
if ! cmp "$@"
then
test "x$1" = x- || test -e "$1" || BUG "test_cmp_bin '$1' missing"
test "x$2" = x- || test -e "$2" || BUG "test_cmp_bin '$2' missing"
return 1
fi
} }
# Use this instead of test_cmp to compare files that contain expected and # Use this instead of test_cmp to compare files that contain expected and