aboutsummaryrefslogtreecommitdiff
path: root/tests/lib.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-01-24 03:11:52 -0300
committerEuAndreh <eu@euandre.org>2021-01-24 03:11:52 -0300
commitee6bc4f2ce6da48f25a29931a178159e5801b5d9 (patch)
treee5b13643b29bd51f06d382fde00ed3ce01199423 /tests/lib.sh
parentTODOs.md: Add task-b2c26218-5f21-4efd-afbd-ff6af57a358a (diff)
downloadremembering-ee6bc4f2ce6da48f25a29931a178159e5801b5d9.tar.gz
remembering-ee6bc4f2ce6da48f25a29931a178159e5801b5d9.tar.xz
Add tests/ranking.sh
Diffstat (limited to '')
-rwxr-xr-xtests/lib.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/lib.sh b/tests/lib.sh
index f42db2d..efc9368 100755
--- a/tests/lib.sh
+++ b/tests/lib.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-# shellcheck disable=2034
export XDG_DATA_HOME="$PWD/tests/test-profiles"
OUT=
ERR=
STATUS=
-PROFILE=
assert_status() {
if [ "$STATUS" != "$1" ]; then
@@ -16,8 +14,16 @@ assert_status() {
assert_empty_stderr() {
if [ "$(cat "$ERR")" != '' ]; then
- echo "Expected STDERR ($ERR) to be empty, but has content:"
- cat "$ERR"
+ echo "Expected STDERR ($ERR) to be empty, but has content:" >&2
+ cat "$ERR" >&2
+ exit 1
+ fi
+}
+
+assert_stdout() {
+ if [ "$(cat "$OUT")" != "$1" ]; then
+ echo "Bad STDOUT ($OUT), expected '$1', got:" >&2
+ cat "$OUT" >&2
exit 1
fi
}