test hint
This commit is contained in:
@@ -21,15 +21,20 @@ function fail_type {
|
||||
local success regex hint_message
|
||||
success=false
|
||||
hint_message="${3:-}"
|
||||
mapfile -t stderr <<<"$(miaou-bash ./test/stub/scenario.bash "$1" 2>&1 >/dev/null 3>/dev/null)"
|
||||
last_error="${stderr[-1]}"
|
||||
|
||||
# mapfile -t stderr <<<"$(miaou-bash ./test/stub/scenario.bash "$1" 2>&1 >/dev/null 3>/dev/null)"
|
||||
|
||||
miaou-bash ./test/stub/scenario.bash $1 >/dev/null 2>_stderr 3>_miaou
|
||||
mapfile -t stderr <_stderr
|
||||
|
||||
last_error="${stderr[-1]}"
|
||||
regex="^(.*): line ([0-9]+): miaou_error: $2 ([0-9]+)"
|
||||
[[ "${last_error}" =~ $regex ]] && success=true
|
||||
|
||||
# if [[ $success == true && -n "${hint_message}" ]]; then
|
||||
# :
|
||||
# fi
|
||||
if [[ $success == true && -n "${hint_message}" ]]; then
|
||||
grep -q "${hint_message}" _miaou || success=false
|
||||
fi
|
||||
|
||||
if [[ $success == true ]]; then
|
||||
echo -n .
|
||||
else
|
||||
@@ -58,7 +63,7 @@ fail_type exit EXIT
|
||||
fail_type command_not_found COMMAND_NOT_FOUND
|
||||
fail_type source_not_found SOURCE_NOT_FOUND
|
||||
fail_type file_not_found FILE_NOT_FOUND
|
||||
fail_type child_error CHILD_ERROR '(hint: prefer source than subshell)'
|
||||
fail_type child_error CHILD_ERROR '(hint: prefer source than child process)'
|
||||
|
||||
failed=${#failures[@]}
|
||||
success=$((test_count - failed))
|
||||
|
||||
Reference in New Issue
Block a user