|
|
@ -22,9 +22,10 @@ function strip_ansi { |
|
|
|
|
|
|
|
|
function fail_type { |
|
|
function fail_type { |
|
|
((TEST_COUNT++)) |
|
|
((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)" |
|
|
mapfile -t stderr <<<"$(./test/stub/scenario.bash "$1" 2>&1 >/dev/null)" |
|
|
# echo "stderr countains ${#stderr[@]}" |
|
|
|
|
|
|
|
|
echo "stderr countains ${#stderr[@]}" |
|
|
error_start_above=false |
|
|
error_start_above=false |
|
|
regex="║[[:blank:]]+([A-Z|_]+)" |
|
|
regex="║[[:blank:]]+([A-Z|_]+)" |
|
|
for i in "${stderr[@]}"; do |
|
|
for i in "${stderr[@]}"; do |
|
|
@ -40,6 +41,7 @@ function fail_type { |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
done |
|
|
done |
|
|
|
|
|
[[ -n "${hint_message}" ]] && echo "hint message to find out..." |
|
|
echo "error in: $1" && return 1 |
|
|
echo "error in: $1" && return 1 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -55,8 +57,7 @@ fail_type command_not_found COMMAND_NOT_FOUND |
|
|
fail_type exit EXIT |
|
|
fail_type exit EXIT |
|
|
fail_type source_not_found SOURCE_NOT_FOUND |
|
|
fail_type source_not_found SOURCE_NOT_FOUND |
|
|
fail_type file_not_found FILE_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)) |
|
|
failed=$((TEST_COUNT - SUCCESS_COUNT)) |
|
|
|
|
|
|
|
|
|