git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Brian Gernhardt <brian@gernhardtsoftware.com>,
	Git List <git@vger.kernel.org>
Subject: Re: [PATCH] t6022: Use -eq not = to test output of wc -l
Date: Tue, 16 Nov 2010 08:12:02 +0100	[thread overview]
Message-ID: <4CE22EC2.7040603@viscovery.net> (raw)
In-Reply-To: <7vaalajkiq.fsf@alter.siamese.dyndns.org>

Am 11/15/2010 23:21, schrieb Junio C Hamano:
> Brian Gernhardt <brian@gernhardtsoftware.com> writes:
> 
>> When comparing numbers such as "3" to "$(wc -l)", we should check for
>> numerical equality using -eq instead of string equality using = because
>> some implementations of wc output extra whitespace.
>>
>> Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
>> ---
>>  The alternative would be to use 3 = $(wc -l) (sans quotes), but other parts
>>  of the test used the -eq method.
> 
> ... which looks a tad ugly.
> 
> How about doing something like below after merging Jonathan's fb3340a
> (test-lib: introduce test_line_count to measure files, 2010-10-31) instead?
> 
> -- >8 --
> test_line_count: learn how to read from a pipe

I don't think that any of this (neither Jonathan's nor yours) has any benefit:

- The result is not easier to read.

- Nor are the lines of shell code shorter.

- If something in the pipe requires quoting, you need an extra level of
quotes.

- It doesn't save any messages or fix-ups during review: instead of "do
not quote!" we have to say "use test_line_count!".

Just my opinion.

-- Hannes

  parent reply	other threads:[~2010-11-16  7:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-08 21:29 [PATCH] t6022: Use -eq not = to test output of wc -l Brian Gernhardt
2010-11-08 21:35 ` Ævar Arnfjörð Bjarmason
2010-11-08 21:38   ` Jonathan Nieder
2010-11-15 22:21 ` Junio C Hamano
2010-11-16  6:46   ` Bert Wesarg
2010-11-16  7:12   ` Johannes Sixt [this message]
2010-11-16 17:10     ` Jonathan Nieder
2010-11-16 19:10       ` Junio C Hamano
2010-11-16 19:23         ` 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=4CE22EC2.7040603@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=brian@gernhardtsoftware.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).