Subject: Re: [PATCH] test-lib-functions: simplify `test_file_not_empty` failure message

From: Junio C Hamano <[email-masked]>
Date: Sat, 02 Mar 2024 10:08:30 -0800

Rubén Justo <[email-masked]> writes:

> To improve the accuracy of the message, I wonder if it is worth doing
> ...
> diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
> index b5eaf7fdc1..5b5ee0dc1d 100644
> --- a/t/test-lib-functions.sh
> +++ b/t/test-lib-functions.sh
> @@ -989,9 +989,10 @@ test_dir_is_empty () {
>  # Check if the file exists and has a size greater than zero
>  test_file_not_empty () {
>         test "$#" = 2 && BUG "2 param"
> +       test_path_is_file "$1" &&
>         if ! test -s "$1"
>         then
> -               echo "'$1' is not a non-empty file."
> +		echo "'$1' is empty but should not be"
>                 false
>         fi
>  }

Simple and effective to remove the need to have to worry about the
"missing" case.  The "but should not be" part may still be subject
to discussion, but I do not have a strong opinion there.