almost done with command_not_found

This commit is contained in:
pvincent
2026-07-29 17:48:03 +04:00
parent a0057f93be
commit 75be83eb94
2 changed files with 57 additions and 18 deletions
+3 -3
View File
@@ -24,7 +24,7 @@ function fail_type {
mapfile -t stderr <<<"$(./poc ./test/stub/scenario.bash "$1" 2>&1 >/dev/null 3>/dev/null)"
last_error="${stderr[-1]}"
regex="^(.*): line ([0-9]+): miaou_error: $2 ([0-9]+) payload: (.*)\$"
regex="^(.*): line ([0-9]+): miaou_error: $2 ([0-9]+)"
[[ "${last_error}" =~ $regex ]] && success=true
# if [[ $success == true && -n "${hint_message}" ]]; then
@@ -60,13 +60,13 @@ fail_type command_not_found COMMAND_NOT_FOUND
# fail_type subshell_error COMMAND_NOT_FOUND '(hint: prefer source than subshell)'
# fail_type command_error COMMAND_ERROR
failed=$((test_count - ${#failures[@]}))
failed=${#failures[@]}
success=$((test_count - failed))
echo
if [[ $failed -gt 0 ]]; then
ratio=$((100 * success / test_count))
echo "${ratio}% passed, $success succeeded, $failed failed!"
echo "${ratio}% passed, ${test_count} tests, ${failed} failed!"
echo failures:
for failure in "${failures[@]}"; do
echo -e "\t- $failure"