Re: [PATCH v2 5/6] t: convert grep assertions to test_grep
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 28, 2026, 01:41 UTC
- Message-ID
- <xmqqldbz4f1a.fsf@gitster.g>
- In-Reply-To
- <xmqq4iio59uv.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 16 quoted lines
> SZEDER Gábor <szeder.dev@gmail.com> writes: > >> I think in this case checking the file3's contents is wrong, because >> at this point file3 should not exist in the first place. I've sent a >> patch to fix this long ago, but apparently didn't manage to follow >> through back then. >> >> https://lore.kernel.org/git/20211010172809.1472914-1-szeder.dev@gmail.com/ > > Thanks. I guess the test_grep can be extended to catch this case, > where > > test_grep ! -e pattern1 -e pattern2 file > > does not find any hits, but only because 'file' is missing, as an > error, ...
Wait. The necessary check is already there, isn't it?
test_grep () {
eval "last_arg=\${$#}" test -f "$last_arg" ||
BUG "test_grep requires a file to read as the last parameter"So why don't we see it every time we run that test that inspects file3's contents with Michael's series merged in? Puzzled...