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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rubén Justo <rjusto@xxxxxxxxx> 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.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux