Re: [PATCH 05/11] t7450: make test "set -e" clean
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Mar 25, 2026, 07:15 UTC
- Message-ID
- <acOLo9Jdw2VkwQpc@pks.im>
- In-Reply-To
- <20260325062114.2067946-6-gitster@pobox.com>
On Tue, Mar 24, 2026 at 11:21:08PM -0700, Junio C Hamano wrote:
Show 16 quoted lines
> In order to catch mistakes like misspelling "test_expect_success", > we would like to eventually be able to run our test suite with the > "-e" option on. > > Often we write "A && test_expect_success ..." and want it to mean > "If and only if A holds true, this needs to be tested", but under > "set -e", this will cause failure when A does not hold true. We > need to write "!A || test_expect_success ..." if we want to run the > test conditionally. > > Or write it properly with if/then/fi, perhaps like: > > if ! A > then > test_expect_success ... > fi
Yeah, that's what I have, mostly because I find it easier to reason about.
Patrick