bash_tap: Implement mechanism to mark a test as expected failure

Test author can now mark a bash tap test as expected failure by setting
EXPFAIL environment variable to a non-zero value.
This commit is contained in:
Tomas Babej 2021-01-30 22:18:43 -05:00
parent a5eee5fcc6
commit 5317f7c795

View file

@ -7,7 +7,14 @@ function bashtap_on_error {
# A command in the parent script failed, interpret this as a test failure.
# $bashtap_line contains the last executed line, or an error.
echo -n "$bashtap_output"
echo "not ok 1 - ${bashtap_line}"
# Determine if this failure was expected
if [[ ! -z "$EXPFAIL" ]]
then
todo_suffix=" # TODO"
fi
echo "not ok 1 - ${bashtap_line}${todo_suffix}"
bashtap_clean_tmpdir
}