threads / patch / 66471

patcht0450: use test_path_is_file and test_path_is_missing

Subject: [PATCH] t0450: use test_path_is_file and test_path_is_missing

## tl;dr

2 messages between Oct 6, 2026 and Oct 6, 2026. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Muhammed Dilshad A· Oct 6, 2026, 10:14 UTC · lore

Replace raw 'test -f' and '! test -f' assertions with the test helper functions 'test_path_is_file' and 'test_path_is_missing' to provide diagnostic output when an assertion fails.

Signed-off-by: Muhammed Dilshad A <dilsheddilu123@gmail.com>
---
 t/t0450-txt-doc-vs-help.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Show changes to t/t0450-txt-doc-vs-help.sh +2 −2
diff --git a/t/t0450-txt-doc-vs-help.sh b/t/t0450-txt-doc-vs-help.sh
index 55c0fb3cb7..a2da2b0192 100755
--- a/t/t0450-txt-doc-vs-help.sh
+++ b/t/t0450-txt-doc-vs-help.sh
@@ -116,13 +116,13 @@ do
 	if grep -q "^$builtin$" "$TEST_DIRECTORY"/t0450/adoc-missing
 	then
 		test_expect_success "$builtin appropriately marked as not having .adoc" '
-			! test -f "$adoc"
+			test_path_is_missing "$adoc"
 		'
 	else
 		test_set_prereq "$preq"
 
 		test_expect_success "$builtin appropriately marked as having .adoc" '
-			test -f "$adoc"
+			test_path_is_file "$adoc"
 		'
 	fi
 
-- 
2.55.0
Patrick Steinhardt· Oct 6, 2026, 12:23 UTC · re: Muhammed Dilshad A · lore

Re: [PATCH] t0450: use test_path_is_file and test_path_is_missing

On Tue, Oct 06, 2026 at 03:44:58PM +0530, Muhammed Dilshad A wrote:
Show 5 quoted lines
> Replace raw 'test -f' and '! test -f' assertions with the test helper
> functions 'test_path_is_file' and 'test_path_is_missing' to provide
> diagnostic output when an assertion fails.
> 
> Signed-off-by: Muhammed Dilshad A <dilsheddilu123@gmail.com>

Good commit message, pinpointing exactly why we even bother to do this change.

Show 19 quoted lines
> diff --git a/t/t0450-txt-doc-vs-help.sh b/t/t0450-txt-doc-vs-help.sh
> index 55c0fb3cb7..a2da2b0192 100755
> --- a/t/t0450-txt-doc-vs-help.sh
> +++ b/t/t0450-txt-doc-vs-help.sh
> @@ -116,13 +116,13 @@ do
>  	if grep -q "^$builtin$" "$TEST_DIRECTORY"/t0450/adoc-missing
>  	then
>  		test_expect_success "$builtin appropriately marked as not having .adoc" '
> -			! test -f "$adoc"
> +			test_path_is_missing "$adoc"
>  		'
>  	else
>  		test_set_prereq "$preq"
>  
>  		test_expect_success "$builtin appropriately marked as having .adoc" '
> -			test -f "$adoc"
> +			test_path_is_file "$adoc"
>  		'
>  	fi
And the change looks obviously good to me, as well. Thanks!
Patrick

← back to recent threads