Skip to content

Commit 8583bf7

Browse files
avargitster
authored andcommitted
test-lib.sh: de-duplicate error() teardown code
De-duplicate the "finalize_junit_xml; GIT_EXIT_OK=t; exit 1" code shared between the "error()" and "--immediate on failure" code paths, in preparation for adding a third user in a subsequent commit. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2bd2f25 commit 8583bf7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

t/test-lib.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,13 +589,17 @@ USER_TERM="$TERM"
589589
TERM=dumb
590590
export TERM USER_TERM
591591

592-
error () {
593-
say_color error "error: $*"
592+
_error_exit () {
594593
finalize_junit_xml
595594
GIT_EXIT_OK=t
596595
exit 1
597596
}
598597

598+
error () {
599+
say_color error "error: $*"
600+
_error_exit
601+
}
602+
599603
BUG () {
600604
error >&7 "bug in the test script: $*"
601605
}
@@ -720,7 +724,7 @@ test_failure_ () {
720724
say_color error "not ok $test_count - $1"
721725
shift
722726
printf '%s\n' "$*" | sed -e 's/^/# /'
723-
test "$immediate" = "" || { finalize_junit_xml; GIT_EXIT_OK=t; exit 1; }
727+
test "$immediate" = "" || _error_exit
724728
}
725729

726730
test_known_broken_ok_ () {

0 commit comments

Comments
 (0)