From d17fd93d60b93fab2876553dde2bbc71c65bd14c Mon Sep 17 00:00:00 2001 From: pvincent Date: Fri, 24 Jul 2026 14:41:01 +0400 Subject: [PATCH] test command_not_found --- bin/miaou-bash | 7 +++---- test/miaou-bash.test.bash | 1 + test/stub/scenario.bash | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bin/miaou-bash b/bin/miaou-bash index 4025d64..7918878 100755 --- a/bin/miaou-bash +++ b/bin/miaou-bash @@ -207,16 +207,15 @@ function ansi_block_continuation { function ansi_block_error { FG=BLACK BG=RED - PADDING=2 local content detail exit_code content=$(style_ansi "$1") - content=$(style_padding "$content") + content=$(PADDING=2 style_padding "$content") detail="$2" - [[ -n "$detail" ]] && detail=$(BG=BLACK FG=WHITE PADDING_LEFT=4 style_padding "$2") + [[ -n "$detail" ]] && detail=$(BG=BLACK FG=WHITE PADDING=2 style_padding "$2") - exit_code=$(FG=CYAN style_ansi "$3") + exit_code=$(FG=CYAN PADDING=2 style_padding "$3") builtin echo -en "\r" BLOCK_CONTINUATION_COL=5 style_block "$content$detail$exit_code" ansi_reset diff --git a/test/miaou-bash.test.bash b/test/miaou-bash.test.bash index 098a051..7f04781 100755 --- a/test/miaou-bash.test.bash +++ b/test/miaou-bash.test.bash @@ -51,6 +51,7 @@ fail_type subshell_term SUBSHELL_TERM fail_type unbound_variable UNBOUND_VARIABLE fail_type false FALSE fail_type return RETURN +fail_type command_not_found COMMAND_NOT_FOUND failed=$((TEST_COUNT - SUCCESS_COUNT)) if [[ $failed -gt 0 ]]; then diff --git a/test/stub/scenario.bash b/test/stub/scenario.bash index dd8e1bd..ea5be6f 100755 --- a/test/stub/scenario.bash +++ b/test/stub/scenario.bash @@ -26,6 +26,11 @@ function do_last_false { function do_return { echo START return 99 +} + +function do_command_not_found { + echo START + command_not_found A B C echo SHOULD NOT APPEAR }