aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-01-24 01:41:41 -0300
committerEuAndreh <eu@euandre.org>2021-01-24 01:41:41 -0300
commitf33221932346ebd67c66840bcb98f826ca369566 (patch)
treea12873c200275f7b8e282943670e50e07bc6e6fc /tests
parentRemove tests/all.sh (diff)
downloadremembering-f33221932346ebd67c66840bcb98f826ca369566.tar.gz
remembering-f33221932346ebd67c66840bcb98f826ca369566.tar.xz
Add tests/lib.sh
Diffstat (limited to '')
-rwxr-xr-xtests/cli-opts.sh12
-rwxr-xr-xtests/lib.sh14
2 files changed, 15 insertions, 11 deletions
diff --git a/tests/cli-opts.sh b/tests/cli-opts.sh
index a6be446..5edbc17 100755
--- a/tests/cli-opts.sh
+++ b/tests/cli-opts.sh
@@ -1,17 +1,7 @@
#!/bin/sh
set -u
-export XDG_DATA_HOME="$PWD/tests/test-profiles"
-OUT=
-ERR=
-STATUS=
-
-assert_status() {
- if [ "$STATUS" != "$1" ]; then
- echo "Unexpected status: $STATUS, expected: $1"
- exit 1
- fi
-}
+. tests/lib.sh
assert_usage() {
if ! grep -Fq 'Usage' "$ERR"; then
diff --git a/tests/lib.sh b/tests/lib.sh
new file mode 100755
index 0000000..fb50d8a
--- /dev/null
+++ b/tests/lib.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+export XDG_DATA_HOME="$PWD/tests/test-profiles"
+OUT=
+ERR=
+STATUS=
+PROFILE=
+
+assert_status() {
+ if [ "$STATUS" != "$1" ]; then
+ printf 'Bad status.\n\nexpected: %s\ngot: %s\n' "$1" "$STATUS" >&2
+ exit 1
+ fi
+}