aboutsummaryrefslogtreecommitdiff
path: root/tests/lib.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-01-24 14:56:02 -0300
committerEuAndreh <eu@euandre.org>2021-01-24 14:56:02 -0300
commitb9061b44194c6564364ee41dfda17df171547cf4 (patch)
tree7f1c15858005b4f827f879e52b3d3ad5f9cc7fa6 /tests/lib.sh
parentremembering: Append to in-memory string instead of intermediate file (diff)
downloadremembering-b9061b44194c6564364ee41dfda17df171547cf4.tar.gz
remembering-b9061b44194c6564364ee41dfda17df171547cf4.tar.xz
tests: Add logs of which test is running
Diffstat (limited to 'tests/lib.sh')
-rwxr-xr-xtests/lib.sh19
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
+}