Context
bashunit::runner::detect_runtime_error (src/runner.sh:93-114) loops over 23 error strings, running case on each iteration. For test outputs without errors (the common case) it walks the full list.
Proposal
Collapse to a single case with glob alternation, short-circuit early:
function bashunit::runner::detect_runtime_error() {
local runtime_output=\$1
case \"\$runtime_output\" in
*\"command not found\"* | *\"unbound variable\"* | *\"permission denied\"* | \\
*\"no such file or directory\"* | *\"syntax error\"* | *\"bad substitution\"* | \\
*\"division by 0\"* | *\"cannot allocate memory\"* | *\"bad file descriptor\"* | \\
*\"segmentation fault\"* | *\"illegal option\"* | *\"argument list too long\"* | \\
*\"readonly variable\"* | *\"missing keyword\"* | *killed* | \\
*\"cannot execute binary file\"* | *\"invalid arithmetic operator\"* | \\
*\"ambiguous redirect\"* | *\"integer expression expected\"* | \\
*\"too many arguments\"* | *\"value too great\"* | \\
*\"not a valid identifier\"* | *\"unexpected EOF\"*)
local runtime_error=\"\${runtime_output#*: }\"
printf '%s' \"\${runtime_error//\$'\\n'/}\"
return 0
;;
esac
printf ''
}
Single pattern match, no Bash loop, no per-iteration case setup.
Acceptance
Context
bashunit::runner::detect_runtime_error(src/runner.sh:93-114) loops over 23 error strings, runningcaseon each iteration. For test outputs without errors (the common case) it walks the full list.Proposal
Collapse to a single
casewith glob alternation, short-circuit early:Single pattern match, no Bash loop, no per-iteration
casesetup.Acceptance
casematches all error strings