t: use verbose instead of hand-rolled errors
Many tests that predate the "verbose" helper function use a pattern like: test ... || { echo ... false } to give more verbose output. Using the helper, we can do this with a single line, and avoid a || which interacts badly with &&-chaining (besides fooling --chain-lint, we hit the error block no matter which command in the chain failed, so we may often show useless results). In most cases, the messages printed by "verbose" are equally good (in some cases better; t6006 accidentally redirects the message to a file!). The exception is t7001, whose output suffers slightly. However, it's still enough to show the user which part failed, given that we will have just printed the test script to stderr. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
5ca812a19c
commit
a167ece0c8
@ -20,10 +20,7 @@ test_expect_success setup '
|
||||
test_expect_success 'detect rewrite' '
|
||||
|
||||
actual=$(git diff-files -B --summary test) &&
|
||||
expr "$actual" : " rewrite test ([0-9]*%)$" || {
|
||||
echo "Eh? <<$actual>>"
|
||||
false
|
||||
}
|
||||
verbose expr "$actual" : " rewrite test ([0-9]*%)$"
|
||||
|
||||
'
|
||||
|
||||
|
Reference in New Issue
Block a user