diff options
author | EuAndreh <eu@euandre.org> | 2021-01-24 14:56:02 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-01-24 14:56:02 -0300 |
commit | b9061b44194c6564364ee41dfda17df171547cf4 (patch) | |
tree | 7f1c15858005b4f827f879e52b3d3ad5f9cc7fa6 /tests/lib.sh | |
parent | remembering: Append to in-memory string instead of intermediate file (diff) | |
download | remembering-b9061b44194c6564364ee41dfda17df171547cf4.tar.gz remembering-b9061b44194c6564364ee41dfda17df171547cf4.tar.xz |
tests: Add logs of which test is running
Diffstat (limited to 'tests/lib.sh')
-rwxr-xr-x | tests/lib.sh | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/lib.sh b/tests/lib.sh index f7f4415..8d77068 100755 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -7,23 +7,24 @@ STATUS= assert_status() { if [ "$STATUS" != "$1" ]; then - printf 'Bad status.\n\nexpected: %s\ngot: %s\n' "$1" "$STATUS" >&2 + printf '\nERR: Bad status.\n\nexpected: %s\ngot: %s\n' \ + "$1" "$STATUS" >&2 exit 1 fi } assert_empty_stderr() { if [ "$(cat "$ERR")" != '' ]; then - echo "Expected STDERR ($ERR) to be empty, but has content:" >&2 - cat "$ERR" >&2 + printf '\nERR: Expected STDERR (%s) to be empty, but has content:\n%s\n' \ + "$ERR" "$(cat "$ERR")" >&2 exit 1 fi } assert_stdout() { if [ "$(cat "$OUT")" != "$1" ]; then - echo "Bad STDOUT ($OUT), expected '$1', got:" >&2 - cat "$OUT" >&2 + printf '\nERR: Bad STDOUT (%s)\nexpected: %s\ngot: %s\n' \ + "$OUT" "$1" "$(cat "$OUT")" >&2 exit 1 fi } @@ -35,3 +36,11 @@ uuid() { head -1 | \ awk '{OFS="-"; print $2$3,$4,$5,$6,$7$8$9}' } + +testing() { + printf 'testing: %s...' "$1" >&2 +} + +test_ok() { + printf ' OK.\n' >&2 +} |