Bats: show output on failed assertions

This commit is contained in:
Ivan Pozdeev 2021-09-16 01:55:02 +03:00
parent f504b01818
commit c6c4e41eb9

View file

@ -44,7 +44,8 @@ flunk() {
assert_success() { assert_success() {
if [ "$status" -ne 0 ]; then if [ "$status" -ne 0 ]; then
flunk "command failed with exit status $status" flunk "command failed with exit status $status" $'\n'\
"output: $output"
elif [ "$#" -gt 0 ]; then elif [ "$#" -gt 0 ]; then
assert_output "$1" assert_output "$1"
fi fi
@ -52,7 +53,8 @@ assert_success() {
assert_failure() { assert_failure() {
if [ "$status" -eq 0 ]; then if [ "$status" -eq 0 ]; then
flunk "expected failed exit status" flunk "expected failed exit status" $'\n'\
"output: $output"
elif [ "$#" -gt 0 ]; then elif [ "$#" -gt 0 ]; then
assert_output "$1" assert_output "$1"
fi fi