From c6c4e41eb99c6f52f3d2b4a69e501b4713643eb5 Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Thu, 16 Sep 2021 01:55:02 +0300 Subject: [PATCH] Bats: show output on failed assertions --- test/test_helper.bash | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test_helper.bash b/test/test_helper.bash index b11d65bd..30615cd3 100644 --- a/test/test_helper.bash +++ b/test/test_helper.bash @@ -44,7 +44,8 @@ flunk() { assert_success() { 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 assert_output "$1" fi @@ -52,7 +53,8 @@ assert_success() { assert_failure() { if [ "$status" -eq 0 ]; then - flunk "expected failed exit status" + flunk "expected failed exit status" $'\n'\ + "output: $output" elif [ "$#" -gt 0 ]; then assert_output "$1" fi