Subject: Re: difftool--helper: exit when reading a prompt answer fails

From: Junio C Hamano <[email-masked]>
Date: Mon, 27 Oct 2014 10:38:15 -0700

David Aguilar <[email-masked]> writes:

>> diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
>> index dc30a51..9cf5dc9 100755
>> --- a/t/t7800-difftool.sh
>> +++ b/t/t7800-difftool.sh
>> @@ -301,6 +301,14 @@ test_expect_success PERL 'say no to the second file' '
>>  	! grep br2 output
>>  '
>>  
>> +test_expect_success PERL 'ending prompt input with EOF' '
>> +	git difftool -x cat branch </dev/null >output &&
>> +	! grep master output &&
>> +	! grep branch output &&
>> +	! grep m2 output &&
>> +	! grep br2 output
>> +'
>
> Should we use "test_must_fail grep ..." instead of "! grep ..." here?

NO.  We do not expect system-supplied "grep" to dump core and
declare it as a test failure.  test_must_fail is for catching an
expected non-zero status exit from git commands, i.e. when we expect
our binary to correctly notice some condition and report that fact
with non-zero exit status, we do not want to mistake the binary
segfaulting as working correctly.