Browse Source

test command_not_found

main
pvincent 1 day ago
parent
commit
d17fd93d60
  1. 7
      bin/miaou-bash
  2. 1
      test/miaou-bash.test.bash
  3. 5
      test/stub/scenario.bash

7
bin/miaou-bash

@ -207,16 +207,15 @@ function ansi_block_continuation {
function ansi_block_error { function ansi_block_error {
FG=BLACK FG=BLACK
BG=RED BG=RED
PADDING=2
local content detail exit_code local content detail exit_code
content=$(style_ansi "$1") content=$(style_ansi "$1")
content=$(style_padding "$content")
content=$(PADDING=2 style_padding "$content")
detail="$2" 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" builtin echo -en "\r"
BLOCK_CONTINUATION_COL=5 style_block "$content$detail$exit_code" BLOCK_CONTINUATION_COL=5 style_block "$content$detail$exit_code"
ansi_reset ansi_reset

1
test/miaou-bash.test.bash

@ -51,6 +51,7 @@ fail_type subshell_term SUBSHELL_TERM
fail_type unbound_variable UNBOUND_VARIABLE fail_type unbound_variable UNBOUND_VARIABLE
fail_type false FALSE fail_type false FALSE
fail_type return RETURN fail_type return RETURN
fail_type command_not_found COMMAND_NOT_FOUND
failed=$((TEST_COUNT - SUCCESS_COUNT)) failed=$((TEST_COUNT - SUCCESS_COUNT))
if [[ $failed -gt 0 ]]; then if [[ $failed -gt 0 ]]; then

5
test/stub/scenario.bash

@ -26,6 +26,11 @@ function do_last_false {
function do_return { function do_return {
echo START echo START
return 99 return 99
}
function do_command_not_found {
echo START
command_not_found A B C
echo SHOULD NOT APPEAR echo SHOULD NOT APPEAR
} }

Loading…
Cancel
Save