From: Felipe Contreras <felipe.contreras@gmail.com>
To: "SZEDER Gábor" <szeder@ira.uka.de>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Jeff King <peff@peff.net>
Subject: Re: [PATCH 1/2] completion: refactor __gitcomp related tests
Date: Wed, 31 Oct 2012 00:02:01 +0100 [thread overview]
Message-ID: <CAMP44s0aN_FU+51huzdtEKOMaw2yhVy4d=jV6YHMeoCKDeqU8Q@mail.gmail.com> (raw)
In-Reply-To: <20121030224558.GN12052@goldbirke>
On Tue, Oct 30, 2012 at 11:45 PM, SZEDER Gábor <szeder@ira.uka.de> wrote:
> On Mon, Oct 22, 2012 at 03:39:00AM +0200, Felipe Contreras wrote:
>> Lots of duplicated code!
>>
>> No functional changes.
>
> I'm not sure.
> I'm all for removing duplicated application code, but I'm usually more
> conservative when it comes to test code. The more logic, the more
> possibility for bugs in tests. So tests should be dead simple, even
> if that means some duplicated test code or the lack of convenience
> functions.
> While this might be considered just a matter of personal preference, ...
Fair enough, but my preference is different: test code should be the
same as normal code; easy to maintain.
>> +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 "$@" &&
>
> ... I was really puzzled by how __gitcomp() gets its arguments here,
> and had to think for a while to figure out why it's not broken.
You mean because "$@" is treated in a special way? Without that
behavior I'm not sure many things would be possible :)
Anyway, I don't think we should make our life more difficult while
maintaining test code... that's my opinion.
Cheers.
--
Felipe Contreras
next prev parent reply other threads:[~2012-10-30 23:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-22 1:38 [PATCH 0/2] completion: test simplifications Felipe Contreras
2012-10-22 1:39 ` [PATCH 1/2] completion: refactor __gitcomp related tests Felipe Contreras
2012-10-30 22:45 ` SZEDER Gábor
2012-10-30 23:02 ` Felipe Contreras [this message]
2012-10-22 1:39 ` [PATCH 2/2] completion: simplify __gitcomp test helper Felipe Contreras
2012-10-30 21:27 ` SZEDER Gábor
2012-10-30 21:43 ` 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
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='CAMP44s0aN_FU+51huzdtEKOMaw2yhVy4d=jV6YHMeoCKDeqU8Q@mail.gmail.com' \
--to=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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.
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).