Re: [PATCH 2/3] t5304: use helper to report failure of "test foo = bar"
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 13, 2014, 21:33 UTC
- Message-ID
- <CAPc5daX7UBvxCw60VUW4rUkKYbD8Do+=Nczq=z=ykoykZA+ywQ@mail.gmail.com>
- In-Reply-To
- <20141013213132.GA32245@google.com>
On Mon, Oct 13, 2014 at 2:31 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 12 quoted lines
> Jeff King wrote: >> On Mon, Oct 13, 2014 at 09:10:22AM -0700, Jonathan Nieder wrote: > >>> There's another downside to that construct: it loses the exit >>> status from some_cmd. >> >> Yes, although I think in many cases it's not a big deal. For example, >> here we lose the exit code of count-objects, but it also is very >> unlikely to fail _and_ produce our expected output. > > It could segfault after producing the good output, but sure, > count-objects code doesn't change very often.
"Doesn't change very often" is not the issue. Here we are not testing if it can count correctly without crashing, which *is* the real reason why it is perfectly fine to use $(git count-objects | sed ...) pattern here.
There of course should be a test for count-objects to make sure it counts correctly without crashing.