On Mon, Oct 7, 2024 at 4:08 AM Patrick Steinhardt [off-list ref] wrote:
On Mon, Oct 07, 2024 at 07:25:44AM +0000, Usman Akinyemi wrote:
quoted
test $base = $(git rev-parse HEAD^) &&
git show >output &&
grep NEVER output >actual &&
test_must_be_empty actual &&
That makes sense. The expectation here is that `output` shouldn't
contain the string "NEVER" at all. And as grep(1) would fail when it
doesn't find a match the whole test would fail like this. So the below
would likely be the best solution.
Thanks. I was just about to respond with the same answer. As a bit of
extra explanation, the &&-chaining means that every command in the
chain must return "success" (status 0), but the return code of `grep`
depends upon whether or not it matched any lines. In this case, it
returned non-zero which caused the test to fail.