All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Kacper Kornet <draenog@pld-linux.org>,
	git@vger.kernel.org, Martin von Zweigbergk <martinvonz@gmail.com>
Subject: Re: [PATCH 3/3] t/t7106-reset-unborn-branch.sh: Add PERL prerequisite
Date: Sat, 24 Aug 2013 23:50:48 -0700	[thread overview]
Message-ID: <xmqq8uzql0vr.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20130824203414.GD2960@elie.Belkin> (Jonathan Nieder's message of "Sat, 24 Aug 2013 13:34:14 -0700")

Jonathan Nieder <jrnieder@gmail.com> writes:

> Kacper Kornet wrote:
>
>> Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
>
> Thanks.
>
> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
>
> Here's a style cleanup on top.
>
> -- >8 --
> Subject: reset test: modernize style
>
> Avoid command substitution and pipes to ensure that the exit status
> from each git command is tested (and in particular that any segfaults
> are caught).

Makes sense.

The change to the one that feeds 'y' to "reset -p" may be a bit too
pedantic, as we are not in the business of testing "echo y", though.

> Maintain the test setup (no commits, one file named "a", another named
> "b") even after the last test, to make it easier to rearrange tests or
> add new tests after the last in the future.
>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
> ---
>  t/t7106-reset-unborn-branch.sh | 31 ++++++++++++++++++++++++-------
>  1 file changed, 24 insertions(+), 7 deletions(-)
>
> diff --git a/t/t7106-reset-unborn-branch.sh b/t/t7106-reset-unborn-branch.sh
> index 499cd88c..af00ab4d 100755
> --- a/t/t7106-reset-unborn-branch.sh
> +++ b/t/t7106-reset-unborn-branch.sh
> @@ -11,7 +11,10 @@ test_expect_success 'setup' '
>  test_expect_success 'reset' '
>  	git add a b &&
>  	git reset &&
> -	test "$(git ls-files)" = ""
> +
> +	>expect &&
> +	git ls-files >actual &&
> +	test_cmp expect actual
>  '
>  
>  test_expect_success 'reset HEAD' '
> @@ -24,28 +27,42 @@ test_expect_success 'reset $file' '
>  	rm .git/index &&
>  	git add a b &&
>  	git reset a &&
> -	test "$(git ls-files)" = "b"
> +
> +	echo b >expect &&
> +	git ls-files >actual &&
> +	test_cmp expect actual
>  '
>  
>  test_expect_success PERL 'reset -p' '
>  	rm .git/index &&
>  	git add a &&
> -	echo y | git reset -p &&
> -	test "$(git ls-files)" = ""
> +	echo y >yes &&
> +	git reset -p <yes &&
> +
> +	>expect &&
> +	git ls-files >actual &&
> +	test_cmp expect actual
>  '
>  
>  test_expect_success 'reset --soft is a no-op' '
>  	rm .git/index &&
>  	git add a &&
> -	git reset --soft
> -	test "$(git ls-files)" = "a"
> +	git reset --soft &&
> +
> +	echo a >expect &&
> +	git ls-files >actual &&
> +	test_cmp expect actual
>  '
>  
>  test_expect_success 'reset --hard' '
>  	rm .git/index &&
>  	git add a &&
> +	test_when_finished "echo a >a" &&
>  	git reset --hard &&
> -	test "$(git ls-files)" = "" &&
> +
> +	>expect &&
> +	git ls-files >actual &&
> +	test_cmp expect actual &&
>  	test_path_is_missing a
>  '

  reply	other threads:[~2013-08-25  6:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-24  4:01 [PATCH 0/3] Fixes for tests run without perl Kacper Kornet
2013-08-24  4:01 ` [PATCH 1/3] Make test "using invalid commit with -C" more strict Kacper Kornet
2013-08-24 20:01   ` Jonathan Nieder
2013-08-25  6:38     ` Junio C Hamano
2013-08-25  6:40       ` Jonathan Nieder
2013-08-24  4:01 ` [PATCH 2/3] t/t3701-add-interactive.sh: Add PERL prerequisite Kacper Kornet
2013-08-24 20:13   ` Jonathan Nieder
2013-08-24  4:01 ` [PATCH 3/3] t/t7106-reset-unborn-branch.sh: " Kacper Kornet
2013-08-24 20:34   ` Jonathan Nieder
2013-08-25  6:50     ` Junio C Hamano [this message]
2013-08-25  7:09       ` Jonathan Nieder
2013-08-24 19:58 ` [PATCH 0/3] Fixes for tests run without perl Jonathan Nieder

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=xmqq8uzql0vr.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=draenog@pld-linux.org \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=martinvonz@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.