diff options
| author | Jeff King <peff@peff.net> | 2023-03-30 15:30:56 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-03-30 13:07:29 -0700 |
| commit | cc48ddd937f9d852da73e188e4a3216cb038c421 (patch) | |
| tree | 71465217097e165cd40135b32001591bc88946d5 /t/t2006-checkout-index-basic.sh | |
| parent | 750b2604118b4b7d9983f77adeb36d839107861f (diff) | |
tests: skip test_eval_ in internal chain-lint
To check for broken &&-chains, we run "fail_117 && $1" as a test
snippet, and check the exit code. We use test_eval_ to do so, because
that's the way we run the actual test.
But we don't need any of its niceties, like "set -x" tracing. In fact,
they hinder us, because we have to explicitly disable them. So let's
skip that and use "eval" more directly, which is simpler. I had hoped it
would also be faster, but it doesn't seem to produce a measurable
improvement (probably because it's just running internal shell commands,
with no subshells or forks).
Note that there is one gotcha: even though we don't intend to run any of
the commands if the &&-chain is intact, an error like this:
test_expect_success 'broken' '
# this next line breaks the &&-chain
true
# and then this one is executed even by the linter
return 1
'
means we'll "return 1" from the eval, and thus from test_run_(). We
actually do notice this in test_expect_success, but only by saying "hey,
this test didn't say it was OK, so it must have failed", which is not
right (it should say "broken &&-chain").
We can handle this by calling test_eval_inner_() instead, which is our
trick for wrapping "return" in a test snippet. But to do that, we have
to push the trace code out of that inner function and into test_eval_().
This is arguably where it belonged in the first place, but it never
mattered because the "inner_" function had only one caller.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2006-checkout-index-basic.sh')
0 files changed, 0 insertions, 0 deletions
