From: Junio C Hamano <gitster@pobox.com>
To: "Rubén Justo" <rjusto@gmail.com>
Cc: Eric Sunshine <ericsunshine@charter.net>,
git@vger.kernel.org, Aryan Gupta <garyan447@gmail.com>,
Eric Sunshine <sunshine@sunshineco.com>
Subject: Re: [PATCH] test-lib-functions: simplify `test_file_not_empty` failure message
Date: Sat, 02 Mar 2024 10:08:30 -0800 [thread overview]
Message-ID: <xmqq1q8sy09t.fsf@gitster.g> (raw)
In-Reply-To: <cf978790-4885-4103-946d-10f807048441@gmail.com> ("Rubén Justo"'s message of "Sat, 2 Mar 2024 17:38:57 +0100")
Rubén Justo <rjusto@gmail.com> 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.
prev parent reply other threads:[~2024-03-02 18:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-01 20:49 [PATCH] test-lib-functions: simplify `test_file_not_empty` failure message Eric Sunshine
2024-03-01 22:11 ` Junio C Hamano
2024-03-01 22:59 ` Eric Sunshine
2024-03-02 7:07 ` Dirk Gouders
2024-03-02 17:44 ` Junio C Hamano
2024-03-03 6:42 ` Dirk Gouders
2024-03-02 16:38 ` Rubén Justo
2024-03-02 18:08 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq1q8sy09t.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ericsunshine@charter.net \
--cc=garyan447@gmail.com \
--cc=git@vger.kernel.org \
--cc=rjusto@gmail.com \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).