Skip to contentSkip to conversation

t4014: replace "test -f" with "test_path_is_file"

PATCH New Vinayak Dev 1 participant 1 message Oct 5, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t4014: replace "test -f" with "test_path_is_file"

From: Vinayak Dev <[email protected]>

Many tests in the codebase use test -[e|f|d].. commands
to check for various conditions. However, the test command upon failure simply exits with a non-zero exit code(usually 1). Therefore, replace instances of "test -f" from t/t4014-format-patch.sh with the function test_path_is_file() defined in t/test-lib-functions.sh that exits with a debugging-friendly diagnostic message upon failure.

---
 t/t4014-format-patch.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
t/t4014-format-patch.sh +3 -3
index 0a4ab36c3a..5f7d0836d6 100755
@@ -763,7 +763,7 @@ test_expect_success 'format-patch from a subdirectory (1)' '
 		false
 		;;
 	esac &&
-	test -f "$filename"
+	test_path_is_file "$filename"
 '
 
 test_expect_success 'format-patch from a subdirectory (2)' '
@@ -782,7 +782,7 @@ test_expect_success 'format-patch from a subdirectory (2)' '
 		;;
 	esac &&
 	basename=$(expr "$filename" : ".*/\(.*\)") &&
-	test -f "sub/$basename"
+	test_path_is_file "sub/$basename"
 '
 
 test_expect_success 'format-patch from a subdirectory (3)' '
@@ -794,7 +794,7 @@ test_expect_success 'format-patch from a subdirectory (3)' '
 		git format-patch -1 -o "$TRASH_DIRECTORY"
 	) &&
 	basename=$(expr "$filename" : ".*/\(.*\)") &&
-	test -f "$basename"
+	test_path_is_file "$basename"
 '
 
 test_expect_success 'format-patch --in-reply-to' '

base-commit: d0e8084c65cbf949038ae4cc344ac2c2efd77415

Signature · 1 line
2.41.0