t7110: replace `test -f` with `test_path_is_*` helpers
`test -f` and `! test -f` do not provide clear error messages when they fail. To enhance debuggability, use `test_path_is_file` and `test_path_is_missing`, which instead provide more informative error messages. Note that `! test -f` checks if a path is not a file, while `test_path_is_missing` verifies that a path does not exist. In this specific case the tests are meant to check the absence of the path, making `test_path_is_missing` a valid replacement. Signed-off-by: Matteo Bagnolini <matteobagnolini2003@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matteo Bagnolini committed
Jan 3, 2025 at 14:00 UTC
866ea877036ce581e0d3c130f527631cd8b36bdf
1 file changed
+6
-6
t/t7110-reset-merge.sh
+6
-6
@@ -270,13 +270,13 @@ test_expect_success '--merge is ok with added/deleted merge' '
270
git reset --hard third &&
271
rm -f file2 &&
272
test_must_fail git merge branch3 &&
273
- ! test -f file2 &&
274
- test -f file3 &&
273
+ test_path_is_missing file2 &&
274
+ test_path_is_file file3 &&
275
git diff --exit-code file3 &&
276
git diff --exit-code branch3 file3 &&
277
git reset --merge HEAD &&
278
- ! test -f file3 &&
279
- ! test -f file2 &&
278
+ test_path_is_missing file3 &&
279
+ test_path_is_missing file2 &&
280
git diff --exit-code --cached
281
'
282
@@ -284,8 +284,8 @@ test_expect_success '--keep fails with added/deleted merge' '
284
git reset --hard third &&
285
rm -f file2 &&
286
test_must_fail git merge branch3 &&
287
- ! test -f file2 &&
288
- test -f file3 &&
287
+ test_path_is_missing file2 &&
288
+ test_path_is_file file3 &&
289
git diff --exit-code file3 &&
290
git diff --exit-code branch3 file3 &&
291
test_must_fail git reset --keep HEAD 2>err.log &&