command_error singleline
This commit is contained in:
@@ -69,6 +69,21 @@ TODO: miaou-bash --uninstall
|
||||
|
||||
## TODO
|
||||
|
||||
* [ ] miaou-bash COMMAND_ERROR multiline
|
||||
>
|
||||
|
||||
╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
|
||||
║ COMMAND_ERROR incus exec "$optional_project" "$target" <<-EOF
|
||||
ln -fs "$host_zoneinfo" /etc/localtime
|
||||
dpkg-reconfigure -f noninteractive tzdata
|
||||
EOF
|
||||
1 ║
|
||||
╚════╦═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
|
||||
║
|
||||
╟──▷ /opt/miaou-incus/tools/miaou-create:93 assign_host_zoneinfo
|
||||
╟──▷ /opt/miaou-incus/tools/miaou-create:183 create
|
||||
╟──▷ /opt/miaou-incus/tools/miaou-create:203 <main>
|
||||
|
||||
* [ ] prompt git shows version with `+` when there is more than one commit over current version. ie: v0.0.0 + 2 commits more should display v-1.0.0+
|
||||
* [ ] semver_git_tag should append `RELEASE_NOTES.md` from this TODO markdown file, providing that NEW NOTE section below contains appropriate items to fulfill the current release note
|
||||
* [ ] git log <LATEST_TAG>..HEAD --oneline
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ function on_error {
|
||||
print_miaou_error "${BASH_SOURCE[1]}" "${BASH_LINENO[0]}" "${failure_code}" "${failure_type}"
|
||||
else
|
||||
failure_type="COMMAND_ERROR"
|
||||
failure_payload="${BASH_COMMAND}"
|
||||
failure_payload="${BASH_COMMAND%%$'\n'*}" # first line only
|
||||
print_miaou_error "${BASH_SOURCE[1]}" "${BASH_LINENO[0]}" "${failure_code}" "${failure_type}" "${failure_payload}"
|
||||
|
||||
load_tmp_error # cannot print_miaou_error after investigation
|
||||
|
||||
@@ -62,8 +62,8 @@ inoremap <PageDown> <C-o><C-d><C-o><C-d>
|
||||
inoremap <PageUp> <C-o><C-u><C-o><C-u>
|
||||
|
||||
" Slower Scroll Wheel
|
||||
nnoremap <ScrollWheelUp> <C-u>
|
||||
nnoremap <ScrollWheelDown> <C-d>
|
||||
nnoremap <ScrollWheelUp> k
|
||||
nnoremap <ScrollWheelDown> j
|
||||
vnoremap <ScrollWheelUp> k
|
||||
vnoremap <ScrollWheelDown> j
|
||||
inoremap <ScrollWheelUp> <C-o><C-u>
|
||||
|
||||
@@ -69,6 +69,7 @@ function fail_type {
|
||||
failures+=("$cmd")
|
||||
return 1
|
||||
}
|
||||
|
||||
function fail_stderr_count {
|
||||
((test_count++))
|
||||
local regex count="$2"
|
||||
@@ -87,6 +88,25 @@ function fail_stderr_count {
|
||||
failures+=("$cmd 2>_stderr")
|
||||
return 1
|
||||
}
|
||||
|
||||
function fail_miaou_count {
|
||||
((test_count++))
|
||||
local regex count="$2"
|
||||
|
||||
cmd="./test/stub/scenario.bash $1"
|
||||
# mapfile -t stderr <<<"$(miaou-bash ./test/stub/scenario.bash "$1" 2>&1 >/dev/null 3>/dev/null)"
|
||||
if ! $cmd >/dev/null 2>/dev/null 3>_miaou; then
|
||||
mapfile -t miaou <_miaou
|
||||
if [[ "${#miaou[@]}" == "$count" ]]; then
|
||||
echo -n .
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -n F
|
||||
failures+=("$cmd 3>_miaou")
|
||||
return 1
|
||||
}
|
||||
# main
|
||||
|
||||
set -uo pipefail
|
||||
@@ -116,6 +136,7 @@ time {
|
||||
|
||||
fail_stderr_count unbound_variable 1
|
||||
fail_stderr_count child_error 4
|
||||
fail_miaou_count command_error_multiline 6
|
||||
}
|
||||
failed=${#failures[@]}
|
||||
success=$((test_count - failed))
|
||||
|
||||
@@ -12,6 +12,14 @@ function do_subshell_false {
|
||||
result=$(false)
|
||||
}
|
||||
|
||||
function do_command_error_multiline {
|
||||
miaou-bash <<-EOF
|
||||
echo ok
|
||||
false
|
||||
echo SHOULD NOT APPEAR
|
||||
EOF
|
||||
}
|
||||
|
||||
function do_subshell_term {
|
||||
|
||||
echo first line.
|
||||
|
||||
Reference in New Issue
Block a user