Revert "test_cmp: diagnose incorrect arguments"
This reverts commit d572f52a64c6a69990f72ad6a09504b9b615d2e4; the idea to detect that "test_cmp expect actual" was fed a misspelt filename meant well, but when the version of Git tested exhibits a bug, the reason why these two files do not match may be because one of them did not get created as expected, in which case missing file is not a sign of misspelt filename but is a genuine test failure. Acked-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Oct 16, 2020 at 13:51 UTC
262d5ad5a56005e4f21612f195ca183626b2f9ac
1 file changed
+2
-14
t/test-lib-functions.sh
+2
-14
@@ -905,13 +905,7 @@ test_expect_code () {
905
# - not all diff versions understand "-u"
906
907
test_cmp() {
908
- test $# -eq 2 || BUG "test_cmp requires two arguments"
909
- if ! eval "$GIT_TEST_CMP" '"$@"'
910
- then
911
- test "x$1" = x- || test -e "$1" || BUG "test_cmp '$1' missing"
912
- test "x$2" = x- || test -e "$2" || BUG "test_cmp '$2' missing"
913
- return 1
914
- fi
908
+ eval "$GIT_TEST_CMP" '"$@"'
909
}
910
911
# Check that the given config key has the expected value.
@@ -940,13 +934,7 @@ test_cmp_config() {
934
# test_cmp_bin - helper to compare binary files
935
936
test_cmp_bin() {
943
- test $# -eq 2 || BUG "test_cmp_bin requires two arguments"
944
- if ! cmp "$@"
945
- then
946
- test "x$1" = x- || test -e "$1" || BUG "test_cmp_bin '$1' missing"
947
- test "x$2" = x- || test -e "$2" || BUG "test_cmp_bin '$2' missing"
948
- return 1
949
- fi
937
+ cmp "$@"
938
}
939
940
# Use this instead of test_cmp to compare files that contain expected and