Skip to content

Commit ee5557b

Browse files
committed
Merge branch 'es/test-cmp-typocatcher' into next
Test framework update. * es/test-cmp-typocatcher: test_cmp: diagnose incorrect arguments
2 parents c28eaa6 + d572f52 commit ee5557b

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

t/test-lib-functions.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,13 @@ test_expect_code () {
952952
# - not all diff versions understand "-u"
953953

954954
test_cmp() {
955-
eval "$GIT_TEST_CMP" '"$@"'
955+
test $# -eq 2 || BUG "test_cmp requires two arguments"
956+
if ! eval "$GIT_TEST_CMP" '"$@"'
957+
then
958+
test "x$1" = x- || test -e "$1" || BUG "test_cmp '$1' missing"
959+
test "x$2" = x- || test -e "$2" || BUG "test_cmp '$2' missing"
960+
return 1
961+
fi
956962
}
957963

958964
# Check that the given config key has the expected value.
@@ -981,7 +987,13 @@ test_cmp_config() {
981987
# test_cmp_bin - helper to compare binary files
982988

983989
test_cmp_bin() {
984-
cmp "$@"
990+
test $# -eq 2 || BUG "test_cmp_bin requires two arguments"
991+
if ! cmp "$@"
992+
then
993+
test "x$1" = x- || test -e "$1" || BUG "test_cmp_bin '$1' missing"
994+
test "x$2" = x- || test -e "$2" || BUG "test_cmp_bin '$2' missing"
995+
return 1
996+
fi
985997
}
986998

987999
# Use this instead of test_cmp to compare files that contain expected and

0 commit comments

Comments
 (0)