[TOY PATCH] test-lib: &&-chaining tester
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Oct 6, 2010, 05:31 UTC
- Message-ID
- <20101006053118.GA29289@burratino>
- In-Reply-To
- <1286136014-7728-1-git-send-email-newren@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> --- Hi Elijah,
Elijah Newren wrote:
> This patch series fixes many of the missing &&s in the testsuite.
Thanks again. Here's a little glimpse of a future without missing &&s to play with.
t/test-lib.sh | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh index 932f45b..e3a0e68 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -393,7 +393,17 @@ test_debug () { test "$debug" = "" || eval "$1" } +check_command_chaining_ () { + eval >&3 2>&4 "(exit 189) && $1" + eval_chain_ret=$? + if test "$eval_chain_ret" != 189 + then + error 'bug in the test script: missing "&&" in test commands' + fi +} + test_run_ () { + check_command_chaining_ "$1" test_cleanup=: eval >&3 2>&4 "$1" eval_ret=$? @@ -697,6 +707,7 @@ test_cmp() { # the test to pass. test_when_finished () { + check_command_chaining_ "$test_cleanup" test_cleanup="{ $* } && (exit \"\$eval_ret\"); eval_ret=\$?; $test_cleanup" }
-- 1.7.2.3