git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder@ira.uka.de>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Jeff King <peff@peff.net>, Michael Rappazzo <rappazzo@gmail.com>,
	Duy Nguyen <pclouds@gmail.com>,
	Johannes Sixt <j.sixt@viscovery.net>
Subject: Re: [PATCH v2 2/5] t1500: test_rev_parse: facilitate future test enhancements
Date: Wed, 18 May 2016 18:38:27 +0200	[thread overview]
Message-ID: <20160518183827.Horde.e7PY7wuh3iXKFZgoQ0oLR3D@webmail.informatik.kit.edu> (raw)
In-Reply-To: <20160517193630.10379-3-sunshine@sunshineco.com>


Quoting Eric Sunshine <sunshine@sunshineco.com>:

> Tests run by test_rev_parse() are nearly identical; each invokes
> git-rev-parse with a single option and compares the result against an
> expected value. Such duplication makes it onerous to extend the tests
> since any change needs to be repeated in each test. Avoid the
> duplication by parameterizing the test and driving it via a for-loop.
>
> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
> ---
>  t/t1500-rev-parse.sh | 44 +++++++++++++++++---------------------------
>  1 file changed, 17 insertions(+), 27 deletions(-)
>
> diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh
> index 0194f54..c84f5c3 100755
> --- a/t/t1500-rev-parse.sh
> +++ b/t/t1500-rev-parse.sh

> +	for o in is-bare-repository \
> +		 is-inside-git-dir \
> +		 is-inside-work-tree \
> +		 show-prefix \
> +		 git-dir
> +	do
> +		test $# -eq 0 && break
> +		expect="$1"
> +		test_expect_success "$name: $o" '
> +			echo "$expect" >expect &&
> +			git rev-parse --$o >actual &&

I think that "--$o" looks really weird, but that's subjective, of course.

However, the idea popped up in an other thread[1] that we might want
something like 'git rev-parse --absolute-path --git-dir', which wouldn't
really work with '--$o'.

Even if we don't go that route, perhaps it would be better to list the
options to be tested including their doubledash prefix.


[1] -  
http://thread.gmane.org/gmane.comp.version-control.git/287449/focus=292585

  reply	other threads:[~2016-05-18 16:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-17 19:36 [PATCH v2 0/5] modernize t1500 Eric Sunshine
2016-05-17 19:36 ` [PATCH v2 1/5] t1500: be considerate to future potential tests Eric Sunshine
2016-05-17 19:36 ` [PATCH v2 2/5] t1500: test_rev_parse: facilitate future test enhancements Eric Sunshine
2016-05-18 16:38   ` SZEDER Gábor [this message]
2016-05-18 17:32     ` Eric Sunshine
2016-05-18 17:43       ` Eric Sunshine
2016-05-17 19:36 ` [PATCH v2 3/5] t1500: avoid changing working directory outside of tests Eric Sunshine
2016-05-17 20:37   ` Junio C Hamano
2016-05-17 20:48     ` Eric Sunshine
2016-05-17 21:52       ` Jeff King
2016-05-17 22:48         ` Eric Sunshine
2016-05-17 22:48         ` Junio C Hamano
2016-05-17 23:06           ` SZEDER Gábor
2016-05-18  3:33             ` Eric Sunshine
2016-05-17 19:36 ` [PATCH v2 4/5] t1500: avoid setting configuration options " Eric Sunshine
2016-05-17 19:36 ` [PATCH v2 5/5] t1500: avoid setting environment variables " Eric Sunshine

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=20160518183827.Horde.e7PY7wuh3iXKFZgoQ0oLR3D@webmail.informatik.kit.edu \
    --to=szeder@ira.uka.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=rappazzo@gmail.com \
    --cc=sunshine@sunshineco.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).