git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Elijah Newren <newren@gmail.com>
Cc: git@vger.kernel.org, sunshine@sunshineco.com,
	martin.agren@gmail.com, szeder.dev@gmail.com
Subject: Re: [PATCHv3 3/5] t7406: prefer test_* helper functions to test -[feds]
Date: Tue, 07 Aug 2018 10:34:48 -0700	[thread overview]
Message-ID: <xmqqk1p2krlz.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180807164905.3859-4-newren@gmail.com> (Elijah Newren's message of "Tue, 7 Aug 2018 09:49:03 -0700")

Elijah Newren <newren@gmail.com> writes:

> test -e, test -s, etc. do not provide nice error messages when we hit
> test failures, so use the test_* helper functions from
> test-lib-functions.sh.

Good explanation.

> Note: The use of 'test_path_is_file submodule/.git' may look odd, but
> it is a file which is populated with a
>    gitdir: ../.git/modules/submodule
> directive.  If, in the future, handling of the submodule is changed and
> submodule/.git becomes a directory we can change this to
> test_path_is_dir (or perhaps write a test_path_exists helper function
> that doesn't care whether the path is a file or a directory).

Yup, path_exists would be a good direction going forward.  If we
already have "missing" and use it in this rewrite, it may make sense
to introduce "exists" and use it at the same time here.

>
> Signed-off-by: Elijah Newren <newren@gmail.com>
> ---
>  t/t7406-submodule-update.sh | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
> index c6b7b59350..ab67e373c5 100755
> --- a/t/t7406-submodule-update.sh
> +++ b/t/t7406-submodule-update.sh
> @@ -174,7 +174,7 @@ test_expect_success 'submodule update does not fetch already present commits' '
>  	  git submodule update > ../actual 2> ../actual.err
>  	) &&
>  	test_i18ncmp expected actual &&
> -	! test -s actual.err
> +	test_must_be_empty actual.err
>  '
>  
>  test_expect_success 'submodule update should fail due to local changes' '
> @@ -619,8 +619,8 @@ test_expect_success 'submodule update --init skips submodule with update=none' '
>  	git clone super cloned &&
>  	(cd cloned &&
>  	 git submodule update --init &&
> -	 test -e submodule/.git &&
> -	 test_must_fail test -e none/.git
> +	 test_path_is_file submodule/.git &&
> +	 test_path_is_missing none/.git
>  	)
>  '

  reply	other threads:[~2018-08-07 17:34 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03 23:14 [PATCH] t7406: Make a test_must_fail call fail for the right reason Elijah Newren
2018-08-03 23:40 ` Eric Sunshine
2018-08-03 23:42   ` Eric Sunshine
2018-08-03 23:41 ` Junio C Hamano
2018-08-06 15:25 ` [PATCH 0/2] Simple fixes to t7406 Elijah Newren
2018-08-06 15:25   ` [PATCH 1/3] t7406: simplify by using diff --name-only instead of diff --raw Elijah Newren
2018-08-06 15:25   ` [PATCH 2/3] t7406: avoid having git commands upstream of a pipe Elijah Newren
2018-08-06 15:48     ` SZEDER Gábor
2018-08-06 16:09       ` Elijah Newren
2018-08-06 15:25   ` [PATCH 3/3] t7406: make a test_must_fail call fail for the right reason Elijah Newren
2018-08-07  9:07     ` SZEDER Gábor
2018-08-07 13:46       ` Elijah Newren
2018-08-07  7:50   ` [PATCH 0/2] Simple fixes to t7406 Martin Ågren
2018-08-07 13:40     ` Elijah Newren
2018-08-07 16:49   ` [PATCHv3 0/5] " Elijah Newren
2018-08-07 16:49     ` [PATCHv3 1/5] t7406: simplify by using diff --name-only instead of diff --raw Elijah Newren
2018-08-07 17:29       ` Junio C Hamano
2018-08-07 17:40         ` Elijah Newren
2018-08-07 18:18           ` Junio C Hamano
2018-08-07 16:49     ` [PATCHv3 2/5] t7406: avoid having git commands upstream of a pipe Elijah Newren
2018-08-07 16:49     ` [PATCHv3 3/5] t7406: prefer test_* helper functions to test -[feds] Elijah Newren
2018-08-07 17:34       ` Junio C Hamano [this message]
2018-08-07 16:49     ` [PATCHv3 4/5] t7406: avoid using test_must_fail for commands other than git Elijah Newren
2018-08-07 16:49     ` [PATCHv3 5/5] t7406: fix call that was failing for the wrong reason Elijah Newren
2018-08-07 17:37       ` Junio C Hamano
2018-08-08 16:31     ` [PATCHv4 0/5] Simple fixes to t7406 Elijah Newren
2018-08-08 16:31       ` [PATCHv4 1/5] t7406: fix call that was failing for the wrong reason Elijah Newren
2018-08-08 16:31       ` [PATCHv4 2/5] t7406: simplify by using diff --name-only instead of diff --raw Elijah Newren
2018-08-08 16:31       ` [PATCHv4 3/5] t7406: avoid having git commands upstream of a pipe Elijah Newren
2018-08-08 16:31       ` [PATCHv4 4/5] t7406: prefer test_* helper functions to test -[feds] Elijah Newren
2018-08-08 16:31       ` [PATCHv4 5/5] t7406: avoid using test_must_fail for commands other than git Elijah Newren
2018-08-13 20:28     ` [PATCHv3 0/5] Simple fixes to t7406 SZEDER Gábor
2018-08-18 20:52       ` Elijah Newren

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=xmqqk1p2krlz.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=martin.agren@gmail.com \
    --cc=newren@gmail.com \
    --cc=sunshine@sunshineco.com \
    --cc=szeder.dev@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).