# [PATCH] t1420: use test helpers for lost-found checks

2 messages from 2026-01-11 to 2026-01-11. Participants: Pushkar Singh.
Thread: https://gitlist.dev/t/64771

## Pushkar Singh, 2026-01-11 14:38

Subject: [PATCH] t1420: use test helpers for lost-found checks
Message-ID: <20260111143928.37604-1-pushkarkumarsingh1970@gmail.com>
URL: https://gitlist.dev/e/20260111143928.37604-1-pushkarkumarsingh1970%40gmail.com

```
The lost-found test used raw `test -f` and `ls | wc -l` checks.
Replace them with `test_path_is_file` and `test_line_count` to provide
clearer failure diagnostics and keep the test consistent with the
rest of the test suite.

Signed-off-by: Pushkar Singh <pushkarkumarsingh1970@gmail.com>
---
 t/t1420-lost-found.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/t/t1420-lost-found.sh b/t/t1420-lost-found.sh
index 2fb2f44f02..da1e48d35e 100755
--- a/t/t1420-lost-found.sh
+++ b/t/t1420-lost-found.sh
@@ -28,9 +28,10 @@ test_expect_success 'lost and found something' '
 	test_tick &&
 	git reset --hard HEAD^ &&
 	git fsck --lost-found &&
-	test 2 = $(ls .git/lost-found/*/* | wc -l) &&
-	test -f .git/lost-found/commit/$(cat lost-commit) &&
-	test -f .git/lost-found/other/$(cat lost-other)
+	ls .git/lost-found/*/* >actual &&
+	test_line_count = 2 actual &&
+	test_path_is_file .git/lost-found/commit/$(cat lost-commit) &&
+	test_path_is_file .git/lost-found/other/$(cat lost-other)
 '
 
 test_done
-- 
2.43.0


```

## Pushkar Singh, 2026-01-11 14:50

Subject: Re: [PATCH] t1420: use test helpers for lost-found checks
Message-ID: <CALE2CrRJdNVVc+f5RR4yXBgsuYfGXSPaHUAA3qyLrkM3Met6wA@mail.gmail.com>
URL: https://gitlist.dev/e/CALE2CrRJdNVVc%2Bf5RR4yXBgsuYfGXSPaHUAA3qyLrkM3Met6wA%40mail.gmail.com
In-Reply-To: <20260111143928.37604-1-pushkarkumarsingh1970@gmail.com>

```
I noticed that this test is already being worked on and reviewed in
another thread. I’ll drop this patch to avoid duplication.

Thanks,
Pushkar

On Sun, Jan 11, 2026 at 8:09 PM Pushkar Singh
<pushkarkumarsingh1970@gmail.com> wrote:
>
> The lost-found test used raw `test -f` and `ls | wc -l` checks.
> Replace them with `test_path_is_file` and `test_line_count` to provide
> clearer failure diagnostics and keep the test consistent with the
> rest of the test suite.
>
> Signed-off-by: Pushkar Singh <pushkarkumarsingh1970@gmail.com>
> ---
>  t/t1420-lost-found.sh | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/t/t1420-lost-found.sh b/t/t1420-lost-found.sh
> index 2fb2f44f02..da1e48d35e 100755
> --- a/t/t1420-lost-found.sh
> +++ b/t/t1420-lost-found.sh
> @@ -28,9 +28,10 @@ test_expect_success 'lost and found something' '
>         test_tick &&
>         git reset --hard HEAD^ &&
>         git fsck --lost-found &&
> -       test 2 = $(ls .git/lost-found/*/* | wc -l) &&
> -       test -f .git/lost-found/commit/$(cat lost-commit) &&
> -       test -f .git/lost-found/other/$(cat lost-other)
> +       ls .git/lost-found/*/* >actual &&
> +       test_line_count = 2 actual &&
> +       test_path_is_file .git/lost-found/commit/$(cat lost-commit) &&
> +       test_path_is_file .git/lost-found/other/$(cat lost-other)
>  '
>
>  test_done
> --
> 2.43.0
>

```
