diff options
author | EuAndreh <eu@euandre.org> | 2021-06-28 07:14:55 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-06-28 07:14:55 -0300 |
commit | 4039717113876f6f1352130190f790177ecb983a (patch) | |
tree | 05760f87029b9215433e7e5b6441a541967f443b /tests/tests-lib.sh | |
parent | TODOs.md: Add #task-f5a3d036-f451-f469-56f6-73274162df8e (diff) | |
download | remembering-4039717113876f6f1352130190f790177ecb983a.tar.gz remembering-4039717113876f6f1352130190f790177ecb983a.tar.xz |
tests/*.sh: Refactor error messages to be consistent, move helper all helper funtions to the top
Diffstat (limited to '')
-rwxr-xr-x | tests/tests-lib.sh | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/tests-lib.sh b/tests/tests-lib.sh index a3ce7dc..76f22e3 100755 --- a/tests/tests-lib.sh +++ b/tests/tests-lib.sh @@ -16,7 +16,7 @@ ERROR() { } print_debug_info() { - printf 'LINENO: %s\nOUT: %s\nERR: %s\n' "$N" "$OUT" "$ERR" >&2 + printf 'LINENO: %s\nOUT: %s\n%s: %s\n' "$N" "$OUT" "$(ERROR)" "$ERR" >&2 } assert_status() { @@ -56,8 +56,8 @@ assert_empty_stderr() { assert_stream() { if [ "$(cat "$2")" != "$3" ]; then - printf '\nERR: Bad %s (%s)\n\nexpected: %s\ngot: %s\n' \ - "$1" "$2" "$3" "$(cat "$2")" >&2 + printf '\n%s: Bad %s (%s)\n\nexpected: %s\ngot: %s\n' \ + "$(ERROR)" "$1" "$2" "$3" "$(cat "$2")" >&2 print_debug_info exit 1 fi @@ -73,8 +73,8 @@ assert_stderr() { assert_grep_stream() { if ! grep -qE "$3" "$2"; then - printf '\nERR: Bad %s (%s)\n\ngrepping: %s\nin:\n%s\n' \ - "$1" "$2" "$3" "$(cat "$2")" >&2 + printf '\n%s: Bad %s (%s)\n\ngrepping: %s\nin:\n%s\n' \ + "$(ERROR)" "$1" "$2" "$3" "$(cat "$2")" >&2 print_debug_info exit 1 fi @@ -90,8 +90,8 @@ assert_grep_stderr() { assert_fgrep_stream() { if ! grep -Fq -- "$3" "$2"; then - printf '\nERR: Bad %s (%s)\n\ngrepping: %s\nin:\n%s\n' \ - "$1" "$2" "$3" "$(cat "$2")" >&2 + printf '\n%s: Bad %s (%s)\n\ngrepping: %s\nin:\n%s\n' \ + "$(ERROR)" "$1" "$2" "$3" "$(cat "$2")" >&2 print_debug_info exit 1 fi |