before subshell error test hint
This commit is contained in:
+4
-2
@@ -168,8 +168,10 @@ function on_exit {
|
||||
last_trim=false # keep the last error for next stacktrace
|
||||
error_block=false
|
||||
failure_type='SUBSHELL_ERROR'
|
||||
>&4 echo "SUBSHELL_ERROR caught up"
|
||||
stack_functions[0]="${stack_functions[0]} (hint: prefer source than subshell:2)"
|
||||
#
|
||||
# >&4 echo "SUBSHELL_ERROR caught up ${BASH_SOURCE[*]} ${BASH_LINENO[*]}"
|
||||
#
|
||||
stack_functions[0]="${stack_functions[0]} (hint: prefer source than subshell)"
|
||||
[[ "${code}" == 128 ]] && failure_type='SUBSHELL_SOURCE_NOT_FOUND'
|
||||
else
|
||||
failure_type='UNDEFINED'
|
||||
|
||||
@@ -22,9 +22,10 @@ function strip_ansi {
|
||||
|
||||
function fail_type {
|
||||
((TEST_COUNT++))
|
||||
local i line first error_start_above regex
|
||||
local i line first error_start_above regex hint_message
|
||||
hint_message="${3:-}"
|
||||
mapfile -t stderr <<<"$(./test/stub/scenario.bash "$1" 2>&1 >/dev/null)"
|
||||
# echo "stderr countains ${#stderr[@]}"
|
||||
echo "stderr countains ${#stderr[@]}"
|
||||
error_start_above=false
|
||||
regex="║[[:blank:]]+([A-Z|_]+)"
|
||||
for i in "${stderr[@]}"; do
|
||||
@@ -40,6 +41,7 @@ function fail_type {
|
||||
fi
|
||||
fi
|
||||
done
|
||||
[[ -n "${hint_message}" ]] && echo "hint message to find out..."
|
||||
echo "error in: $1" && return 1
|
||||
}
|
||||
|
||||
@@ -55,8 +57,7 @@ fail_type command_not_found COMMAND_NOT_FOUND
|
||||
fail_type exit EXIT
|
||||
fail_type source_not_found SOURCE_NOT_FOUND
|
||||
fail_type file_not_found FILE_NOT_FOUND
|
||||
fail_type subshell_source_not_found SUBSHELL_SOURCE_NOT_FOUND
|
||||
fail_type subshell_error SUBSHELL_ERROR
|
||||
fail_type subshell_error COMMAND_NOT_FOUND '(hint: prefer source than subshell)'
|
||||
|
||||
failed=$((TEST_COUNT - SUCCESS_COUNT))
|
||||
|
||||
|
||||
@@ -87,17 +87,13 @@ function do_file_not_found {
|
||||
./lib/fake/nope.bash
|
||||
}
|
||||
|
||||
function do_subshell_source_not_found {
|
||||
function do_subshell_error {
|
||||
output=$(miaou_debug "---subshell1--$$ $BASHPID $PPID--")
|
||||
output=$(miaou_debug "---subshell2--$$ $BASHPID $PPID--")
|
||||
: "$output"
|
||||
"${MIAOU_BASH_DIR}/test/stub/extra/library.bash"
|
||||
|
||||
"$BASEDIR/extra/library.bash"
|
||||
}
|
||||
|
||||
function do_subshell_error {
|
||||
:
|
||||
}
|
||||
# FUNCTIONS
|
||||
|
||||
function call_function_which_will_exit {
|
||||
|
||||
Reference in New Issue
Block a user