git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Joel Teichroeb <joel@teichroeb.net>
Cc: Git Mailing List <git@vger.kernel.org>,
	Thomas Gummerer <t.gummerer@gmail.com>,
	Christian Couder <christian.couder@gmail.com>,
	Eric Sunshine <sunshine@sunshineco.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH v4 1/5] stash: improve option parsing test coverage
Date: Thu, 29 Mar 2018 12:39:30 -0700	[thread overview]
Message-ID: <xmqqr2o2658t.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180328222129.22192-2-joel@teichroeb.net> (Joel Teichroeb's message of "Wed, 28 Mar 2018 15:21:25 -0700")

Joel Teichroeb <joel@teichroeb.net> writes:

> In preparation for converting the stash command incrementally to
> a builtin command, this patch improves test coverage of the option
> parsing. Both for having too many paramerters, or too few.
>
> Signed-off-by: Joel Teichroeb <joel@teichroeb.net>
> ---
>  t/t3903-stash.sh | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
> index aefde7b17..8a666c60c 100755
> --- a/t/t3903-stash.sh
> +++ b/t/t3903-stash.sh
> @@ -84,6 +84,17 @@ test_expect_success 'apply stashed changes (including index)' '
>  	test 1 = $(git show HEAD:file)
>  '
>  
> +test_expect_success 'giving too many ref agruments does nothing' '
> +
> +	for type in apply drop pop show "branch stash-branch"
> +	do
> +		test-chmtime =123456789 file &&
> +		test_must_fail git stash $type stash@{0} stash@{1} 2>err &&
> +		test_i18ngrep "Too many" err &&
> +		test 123456789 = $(test-chmtime -v +0 file | sed 's/[^0-9].*$//') || return 1
> +	done
> +'

This is done with "file" whose contents are all different in HEAD,
the index and the working tree.  If the command tries to "push" by
mistake, it will touch the timestamp of "file" and fail the test.
That is a reasonable thing to check.

What do stash@{0} and stash{1} record at this point?  Would they
touch that "file" if the command tries to "apply" or "pop" by
mistake?  Perhaps it deserves a bit of in-code comment here.

As "drop" or "show" would not touch the working tree anyway, the
test for timestamp seems pointless, even though grepping for "Too
many" would be a reasonable test.

  parent reply	other threads:[~2018-03-29 19:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 22:21 [PATCH v4 0/5] Convert some stash functionality to a builtin Joel Teichroeb
2018-03-28 22:21 ` [PATCH v4 1/5] stash: improve option parsing test coverage Joel Teichroeb
2018-03-29 10:10   ` Eric Sunshine
2018-03-29 19:39   ` Junio C Hamano [this message]
2018-03-28 22:21 ` [PATCH v4 2/5] stash: convert apply to builtin Joel Teichroeb
2018-03-29 20:07   ` Junio C Hamano
2018-03-31 17:04     ` Joel Teichroeb
2018-03-28 22:21 ` [PATCH v4 3/5] stash: convert drop and clear " Joel Teichroeb
2018-03-30 16:17   ` Junio C Hamano
2018-03-28 22:21 ` [PATCH v4 4/5] stash: convert branch " Joel Teichroeb
2018-03-28 22:21 ` [PATCH v4 5/5] stash: convert pop " Joel Teichroeb

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqr2o2658t.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=joel@teichroeb.net \
    --cc=sunshine@sunshineco.com \
    --cc=t.gummerer@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).