git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: "Martin Ågren" <martin.agren@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] test-lib-functions: drop redundant diagnostic print
Date: Mon, 31 Oct 2022 21:16:07 +0100	[thread overview]
Message-ID: <221031.864jvj7noz.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <20221031180048.5766-1-martin.agren@gmail.com>


On Mon, Oct 31 2022, Martin Ågren wrote:

> `test_path_is_missing` was introduced back in 2caf20c52b ("test-lib:
> user-friendly alternatives to test [-d|-f|-e]", 2010-08-10). It took the
> path that was supposed to be missing, as well as an optional "diagnosis"
> that would be echoed if the path was found to be alive.
>
> Commit 45a2686441 ("test-lib-functions: remove bug-inducing
> "diagnostics" helper param", 2021-02-12) dropped this diagnostic
> functionality from several `test_path_is_foo` helpers, but note how it
> tweaked the README entry on `test_path_is_missing` without actually
> adjusting its implementation.
>
> Commit e7884b353b ("test-lib-functions: assert correct parameter count",
> 2021-02-12) then followed up by asserting that we get just a single
> argument.
>
> This history leaves us in a state where we assert that we have exactly
> one argument, then go on to anyway check for arguments, echoing them
> all. It's clear that we can simplify this code. We should also note that
> we run `ls -ld "$1"`, so printing the filename a second time doesn't
> really buy us anything. Thus, we can drop the whole `if` block as
> redundant.
>
> Signed-off-by: Martin Ågren <martin.agren@gmail.com>
> ---
>  t/test-lib-functions.sh | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
> index 29d914a12b..796093a7b3 100644
> --- a/t/test-lib-functions.sh
> +++ b/t/test-lib-functions.sh
> @@ -921,10 +921,6 @@ test_path_is_missing () {
>  	then
>  		echo "Path exists:"
>  		ls -ld "$1"
> -		if test $# -ge 1
> -		then
> -			echo "$*"
> -		fi
>  		false
>  	fi
>  }

Thanks, this is an obviously good change, sorry about leaving that loose
end.

  reply	other threads:[~2022-10-31 20:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-31 18:00 [PATCH] test-lib-functions: drop redundant diagnostic print Martin Ågren
2022-10-31 20:16 ` Ævar Arnfjörð Bjarmason [this message]
2022-11-01  1:11 ` Taylor Blau

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=221031.864jvj7noz.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=martin.agren@gmail.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).