git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, "Jeff King" <peff@peff.net>,
	"SZEDER Gábor" <szeder@ira.uka.de>,
	"Jonathan Nieder" <jrnieder@gmail.com>
Subject: Re: [PATCH v2 5/6] completion: refactor __gitcomp related tests
Date: Fri, 16 Nov 2012 11:13:52 -0800	[thread overview]
Message-ID: <7v8va1mkcv.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1352644558-9410-6-git-send-email-felipe.contreras@gmail.com> (Felipe Contreras's message of "Sun, 11 Nov 2012 15:35:57 +0100")

Not asking for a re-roll but am asking for clarification so that I
can locally update before queuing.

Felipe Contreras <felipe.contreras@gmail.com> writes:

> Lots of duplicated code!

... removed, you mean?

> No functional changes.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  t/t9902-completion.sh | 76 ++++++++++++++++++---------------------------------
>  1 file changed, 27 insertions(+), 49 deletions(-)
>
> diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
> index 59cdbfd..66c7af6 100755
> --- a/t/t9902-completion.sh
> +++ b/t/t9902-completion.sh
> @@ -71,87 +71,65 @@ test_completion ()
>  
>  newline=$'\n'
>  
> -test_expect_success '__gitcomp - trailing space - options' '
> -	sed -e "s/Z$//" >expected <<-\EOF &&
> -	--reuse-message=Z
> -	--reedit-message=Z
> -	--reset-author Z
> -	EOF
> +# Test __gitcomp.
> +# Arguments are:
> +# 1: typed text so far (cur)
> +# *: arguments to pass to __gitcomp

s/\*/remainder/, perhaps?  I think you shift $1 out and do not pass
it to __gitcomp.

And expected output is from the standard input just like
test_completion?

> +test_gitcomp ()
> +{
> +	sed -e 's/Z$//' > expected &&
>  	(
>  		local -a COMPREPLY &&
> -		cur="--re" &&
> -		__gitcomp "--dry-run --reuse-message= --reedit-message=
> -				--reset-author" &&
> +		cur="$1" &&
> +		shift &&
> +		__gitcomp "$@" &&
>  		IFS="$newline" &&
>  		echo "${COMPREPLY[*]}" > out
>  	) &&
>  	test_cmp expected out
> +}
> +
> +test_expect_success '__gitcomp - trailing space - options' '
> +	test_gitcomp "--re" "--dry-run --reuse-message= --reedit-message=
> +		--reset-author" <<-EOF
> +	--reuse-message=Z
> +	--reedit-message=Z
> +	--reset-author Z
> +	EOF
>  '

Nice shrinkage.

  reply	other threads:[~2012-11-16 19:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-11 14:35 [PATCH v2 0/6] completion: test consolidations Felipe Contreras
2012-11-11 14:35 ` [PATCH v2 1/6] completion: add comment for test_completion() Felipe Contreras
2012-11-16 20:54   ` SZEDER Gábor
2012-11-16 21:06     ` Felipe Contreras
2012-11-16 21:09       ` Felipe Contreras
2012-11-11 14:35 ` [PATCH v2 2/6] completion: standardize final space marker in tests Felipe Contreras
2012-11-11 14:35 ` [PATCH v2 3/6] completion: simplify tests using test_completion_long() Felipe Contreras
2012-11-11 14:35 ` [PATCH v2 4/6] completion: consolidate test_completion*() tests Felipe Contreras
2012-11-16 23:41   ` Junio C Hamano
2012-11-17 20:26     ` Felipe Contreras
2012-11-11 14:35 ` [PATCH v2 5/6] completion: refactor __gitcomp related tests Felipe Contreras
2012-11-16 19:13   ` Junio C Hamano [this message]
2012-11-16 19:53     ` Felipe Contreras
2012-11-16 21:02   ` SZEDER Gábor
2012-11-16 23:40     ` Junio C Hamano
2012-11-11 14:35 ` [PATCH v2 6/6] completion: simplify __gitcomp() test helper Felipe Contreras

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=7v8va1mkcv.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=peff@peff.net \
    --cc=szeder@ira.uka.de \
    /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).