git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Duy Nguyen <pclouds@gmail.com>,
	Git Mailing List <git@vger.kernel.org>,
	Ramkumar Ramachandra <artagnon@gmail.com>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Stephen Boyd <bebarino@gmail.com>,
	Jens Lehmann <Jens.Lehmann@web.de>
Subject: Re: [PATCH 2/3] test: improve rebase -q test
Date: Sun, 9 Jun 2013 15:41:54 -0500	[thread overview]
Message-ID: <CAMP44s0Qr54+8hbkZ+jmXB628SCPwg1zZo80UBhFe2PCrgQP4Q@mail.gmail.com> (raw)
In-Reply-To: <7vfvwrowd0.fsf@alter.siamese.dyndns.org>

On Sun, Jun 9, 2013 at 3:35 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>> On Sun, Jun 9, 2013 at 2:20 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Felipe Contreras <felipe.contreras@gmail.com> writes:
>>>
>>>> On Sun, Jun 9, 2013 at 1:30 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>>>
>>>>> --- a/t/test-lib-functions.sh
>>>>> +++ b/t/test-lib-functions.sh
>>>>> @@ -606,6 +606,18 @@ test_cmp() {
>>>>>         $GIT_TEST_CMP "$@"
>>>>>  }
>>>>>
>>>>> +# Check if the file expected to be empty is indeed empty, and barfs
>>>>> +# otherwise.
>>>>> +
>>>>> +test_output_must_be_empty () {
>>>>
>>>> Why such a big name? test_empty() does the trick.
>>>
>>> Primarily in order to avoid that exact name "test_empty" that others
>>> may want to use for a helper to check that the contents of a string
>>> variable is empty.
>>
>> Which is never going to happen.
>
> For anything, a failure from
>
>         test -z "$mustbeemptystring"
>
> in the test suite is much harder to diagnose because there is
> nothing left in the trash directory to inspect, as opposed to
>
>         test ! -s "$mustbeemptyfile"
>
> where you can just go there and inspect yourself.

Except that it's usually gone. And I challenge you to find a instance
where there's a test -z "$mustbeemptystring" that throws a test
failure. It will take you time to find it (if there's any).

Moreover, by that rationale, we should call test_cmp, test_file_cmp,
but there's no need, because that's rarely needed (if at all). There
will not be a need for test_string_must_be_empty() just like there's
no need for test_string_cmp().

-- 
Felipe Contreras

  reply	other threads:[~2013-06-09 20:42 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-07 20:32 [PATCH 0/3] Trivial patches Felipe Contreras
2013-06-07 20:32 ` [PATCH 1/3] sequencer: trivial fix Felipe Contreras
2013-06-07 22:49   ` Junio C Hamano
2013-06-07 22:59     ` Felipe Contreras
2013-06-07 20:32 ` [PATCH 2/3] test: improve rebase -q test Felipe Contreras
2013-06-08  2:44   ` Duy Nguyen
2013-06-08 10:15     ` Felipe Contreras
2013-06-09 18:30     ` Junio C Hamano
2013-06-09 18:35       ` Felipe Contreras
2013-06-09 19:20         ` Junio C Hamano
2013-06-09 19:33           ` Felipe Contreras
2013-06-09 20:35             ` Junio C Hamano
2013-06-09 20:41               ` Felipe Contreras [this message]
2013-06-10  9:39                 ` SZEDER Gábor
2013-06-10 15:56                   ` Junio C Hamano
2013-06-10 17:01                     ` Felipe Contreras
2013-06-10 17:27                     ` SZEDER Gábor
2013-06-10 19:07                       ` Johannes Sixt
2013-06-10 20:19                         ` SZEDER Gábor
2013-06-10 19:17                       ` Junio C Hamano
2013-06-09 22:44             ` Philip Oakley
2013-06-09 23:39               ` Junio C Hamano
2013-06-10 20:41       ` Jeff King
2013-06-07 20:32 ` [PATCH 3/3] submodule: remove unnecessary check 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=CAMP44s0Qr54+8hbkZ+jmXB628SCPwg1zZo80UBhFe2PCrgQP4Q@mail.gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=Jens.Lehmann@web.de \
    --cc=artagnon@gmail.com \
    --cc=bebarino@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@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).