Re: [PATCH] t/t3700: convert two uses of negation operator '!' to use test_must_fail
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jul 20, 2010, 17:52 UTC
- Message-ID
- <AANLkTilpspywp68veHtYbtfZytHr_0IThksmtkGAjWRg@mail.gmail.com>
- In-Reply-To
- <20100720163822.GA8492@localhost.localdomain>
On Tue, Jul 20, 2010 at 16:38, Jared Hance <jaredhance@gmail.com> wrote:
Show 20 quoted lines
> On Tue, Jul 20, 2010 at 11:32:33AM -0500, Brandon Casey wrote: >> I think you have misunderstood the explanation of test_must_fail. The >> paragraph you quoted actually recommends using test_must_fail instead >> of "! <git-command>". >> >> It says: >> >> Use this instead of "! <git-command>" to fail when git commands >> segfault. >> >> Or with a slight rewording: >> >> Use test_must_fail instead of "! <git-command>" since test_must_fail >> will fail when <git-command> segfaults. > > I think the wording of description of test_must_fail is slightly > ambiguous. I read it to mean that: > > Use test_must_fail only when you are testing to see if git will > segfault.
I've interpreted it to mean that as well, but it's starting to look like a good example of a garden path sentence.
Anyway, it looks like we're wrong and Brandon was right. But I'm going to submit a doc patch to t/README. Here's the existing use of ! v.s. test_must_fail:
$ cat *.sh | grep -c 'test_must_fail git'
863
$ cat *sh | grep -c '! git '
30I.e. ! is only used to negate non-git commands like test.
The example in the comments for test_must_fail in test-lib.sh backs this up:
# Writing this as "! git checkout ../outerspace" is wrong, because
# the failure could be due to a segv. We want a controlled failure.> Rather than: > > Use test_must_fail to be safe from git segfaults.