diff --git a/poc b/poc index 1d33083..c0fde5b 100755 --- a/poc +++ b/poc @@ -107,8 +107,12 @@ function on_error { if [[ $$ == "$BASHPID" ]]; then if [[ ! -v failure_type ]]; then - failure_type="COMMAND_ERROR" - failure_payload="${BASH_COMMAND}" + if [[ ${BASH_COMMAND} == 'false' ]]; then + failure_type="FALSE" + else + failure_type="COMMAND_ERROR" + failure_payload="${BASH_COMMAND}" + fi print_miaou_error "${BASH_SOURCE[1]}" "${BASH_LINENO[0]}" "${failure_code}" "${failure_type}" fi @@ -270,7 +274,7 @@ function on_exit { miaou_debug "" fi - if [[ -v failure_type ]]; then + if [[ $code -gt 0 && -v failure_type ]]; then 2>&3 >&4 dump_failure 2>&3 >&4 dump_stacktrace fi diff --git a/test/stub/scenario.bash b/test/stub/scenario.bash index 119c58c..958f803 100755 --- a/test/stub/scenario.bash +++ b/test/stub/scenario.bash @@ -69,17 +69,9 @@ function do_false { } function do_success { - echo -n 'SUCCESS args=[' - ( - IFS=',' - echo -n "$*" - ) - echo ']' - source "${MIAOU_BASH_DIR}/lib/ansi.bash" - local content - content=$(PADDING_LEFT=2 PADDING_RIGHT=6 style_padding 'this is success') - content=$(FG=YELLOW BG=BLUE style_ansi "$content") - FG=BLACK BG=RED PADDING=8 style_block "$content" + [[ true==true ]] && echo true + ! false && echo unfalse + return } function do_unbound_variable {