100% tests

This commit is contained in:
pvincent
2026-09-01 15:26:50 +04:00
parent 48e3e11695
commit 8e01117112
3 changed files with 23 additions and 14 deletions
+10 -10
View File
@@ -20,10 +20,8 @@ function is_true {
function miaou_debug {
if is_true "${MIAOU_DEBUG}"; then
local saved_bash_rematch=("${BASH_REMATCH[@]}") # important when regex are used before calling miaou_debug
local i message="$*" padding=''
local compute_hierarchy=true
local regex i message="$*" padding='' compute_hierarchy=true
[[ ! -v miaou_debug_hierarchy ]] && miaou_debug_hierarchy=0
regex='^</' # starts with </
[[ $miaou_debug_hierarchy -gt 0 ]] &&
[[ "${message}" =~ $regex ]] &&
@@ -133,16 +131,16 @@ function on_error {
if [[ "$MIAOU_LOCALE" == 'fr' ]]; then
NBSP=$'\xc2\xa0'
last_error="${last_error//$NBSP/ }"
miaou_debug "<strip_nbsp locale=$MIAOU_LOCALE/>" # FIXME: raise issue 'commande introuvable NBSP' within fr.po!
miaou_debug "<strip_nbsp locale=$MIAOU_LOCALE/>"
fi
regex="$MSG_COMMAND_NOT_FOUND_REGEX"
regex=$MSG_COMMAND_NOT_FOUND_REGEX
if [[ $failure_code == 127 && "$last_error" =~ $regex ]]; then
failure_type='COMMAND_NOT_FOUND'
failure_payload="${BASH_REMATCH[3]}"
miaou_debug "<command_not_found payload=${failure_payload}/>"
else
regex="$MSG_FILE_NOT_FOUND_REGEX"
regex=$MSG_FILE_NOT_FOUND_REGEX
if [[ $failure_code == 127 && "$last_error" =~ $regex ]]; then
failure_type='FILE_NOT_FOUND'
failure_payload="${BASH_REMATCH[3]}"
@@ -495,9 +493,10 @@ function on_exit {
elif [[ ! -v failure_type ]]; then
if [[ ${#tmp_error[@]} -gt 0 ]]; then
last_error="${tmp_error[-1]}"
miaou_debug "<investigate_tmp_error_pass2 last={$last_error}>"
regex="$MSG_UNBOUND_VARIABLE_REGEX"
if [[ $failure_code -eq 1 ]] && [[ "$last_error" =~ $regex ]]; then
regex=$MSG_UNBOUND_VARIABLE_REGEX
if [[ $failure_code == 1 ]] && [[ "$last_error" =~ $regex ]]; then
failure_type='UNBOUND_VARIABLE'
failure_payload="${BASH_REMATCH[3]}"
failure_code=2
@@ -512,8 +511,9 @@ function on_exit {
add_miaou_error "$source" "$line" "${failure_code}" "${failure_type}" "${failure_payload}"
miaou_debug "<unbound_variable source=${source} line=${line} payload=${failure_payload}/>"
else
regex="$MSG_SOURCE_NOT_FOUND_REGEX"
if [[ $failure_code -eq 1 ]] && [[ "$last_error" =~ $regex ]]; then
regex=$MSG_SOURCE_NOT_FOUND_REGEX
miaou_debug "<try failure_code=$failure_code source_not_found=$regex/>"
if [[ $failure_code == 1 ]] && [[ "$last_error" =~ $regex ]]; then
failure_type='SOURCE_NOT_FOUND'
failure_payload="${BASH_REMATCH[3]}"
failure_code=3