# [GSoC][PATCH] t7603: replace test -f by test_path_is_file

2 messages from 2025-02-08 to 2025-02-10. Participants: Lucas Oshiro, Patrick Steinhardt.
Thread: https://gitlist.dev/t/62924

## Lucas Oshiro, 2025-02-08 16:57

Subject: [GSoC][PATCH] t7603: replace test -f by test_path_is_file
Message-ID: <20250208165731.78804-1-lucasseikioshiro@gmail.com>
URL: https://gitlist.dev/e/20250208165731.78804-1-lucasseikioshiro%40gmail.com

```
`test_path_is_file` provides a better output when asserting whether a
file exists. Replace the occurrences of `test -f` in 7603 by it,
facilitating the trace of possible test fails.

Signed-off-by: Lucas Oshiro <lucasseikioshiro@gmail.com>
---
 t/t7603-merge-reduce-heads.sh | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/t/t7603-merge-reduce-heads.sh b/t/t7603-merge-reduce-heads.sh
index 4887ca705b..1f8c3b7ccb 100755
--- a/t/t7603-merge-reduce-heads.sh
+++ b/t/t7603-merge-reduce-heads.sh
@@ -52,12 +52,12 @@ test_expect_success 'merge c1 with c2, c3, c4, c5' '
 	test "$(git rev-parse c3)" = "$(git rev-parse HEAD^3)" &&
 	test "$(git rev-parse c5)" = "$(git rev-parse HEAD^4)" &&
 	git diff --exit-code &&
-	test -f c0.c &&
-	test -f c1.c &&
-	test -f c2.c &&
-	test -f c3.c &&
-	test -f c4.c &&
-	test -f c5.c &&
+	test_path_is_file c0.c &&
+	test_path_is_file c1.c &&
+	test_path_is_file c2.c &&
+	test_path_is_file c3.c &&
+	test_path_is_file c4.c &&
+	test_path_is_file c5.c &&
 	git show --format=%s -s >actual &&
 	! grep c1 actual &&
 	grep c2 actual &&
@@ -75,12 +75,12 @@ test_expect_success 'pull c2, c3, c4, c5 into c1' '
 	test "$(git rev-parse c3)" = "$(git rev-parse HEAD^3)" &&
 	test "$(git rev-parse c5)" = "$(git rev-parse HEAD^4)" &&
 	git diff --exit-code &&
-	test -f c0.c &&
-	test -f c1.c &&
-	test -f c2.c &&
-	test -f c3.c &&
-	test -f c4.c &&
-	test -f c5.c &&
+	test_path_is_file c0.c &&
+	test_path_is_file c1.c &&
+	test_path_is_file c2.c &&
+	test_path_is_file c3.c &&
+	test_path_is_file c4.c &&
+	test_path_is_file c5.c &&
 	git show --format=%s -s >actual &&
 	! grep c1 actual &&
 	grep c2 actual &&
-- 
2.47.1


```

## Patrick Steinhardt, 2025-02-10 06:48

Subject: Re: [GSoC][PATCH] t7603: replace test -f by test_path_is_file
Message-ID: <Z6mhU50bt5iYVuZ8@pks.im>
URL: https://gitlist.dev/e/Z6mhU50bt5iYVuZ8%40pks.im
In-Reply-To: <20250208165731.78804-1-lucasseikioshiro@gmail.com>

```
On Sat, Feb 08, 2025 at 01:57:31PM -0300, Lucas Oshiro wrote:
> `test_path_is_file` provides a better output when asserting whether a
> file exists. Replace the occurrences of `test -f` in 7603 by it,

Tiny nit, which probably does not warrant a reroll: it would be nice to
consistently refer to test suites with the "t" prefix, so here you'd say
"t7603" instead of just "7603".

The changes themselv look good to me, thanks!

Patrick

```
