]> arthur.barton.de Git - bup.git/commitdiff
Add trivial tests for current help behavior
authorRob Browning <rlb@defaultvalue.org>
Sat, 8 Aug 2020 16:40:54 +0000 (11:40 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sat, 8 Aug 2020 16:42:10 +0000 (11:42 -0500)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
Makefile
t/test-help [new file with mode: 0755]

index 57f13d15aa3f1e7a0cc9f2fa5320b9d88af9900c..d96c149cb958b5dff7b8195212968216bac81002 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -188,6 +188,7 @@ runtests-python: all t/tmp
            | tee -a t/tmp/test-log/$$$$.log
 
 cmdline_tests := \
+  t/test-help \
   t/test.sh \
   t/test-argv \
   t/test-cat-file.sh \
diff --git a/t/test-help b/t/test-help
new file mode 100755 (executable)
index 0000000..a68b5a0
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+. ./wvtest-bup.sh
+
+set -o pipefail
+
+top="$(WVPASS pwd)" || exit $?
+tmpdir="$(WVPASS wvmktempdir)" || exit $?
+export BUP_DIR="$tmpdir/bup"
+export GIT_DIR="$tmpdir/bup"
+
+bup() { "$top/bup" "$@"; }
+
+# FIXME: send help to stdout if requested (exit 0), stderr on error
+# (exit nonzero)
+
+bup -?
+rc=$?
+WVPASSEQ 99 "$rc"
+
+bup --help
+rc=$?
+WVPASSEQ 99 "$rc"
+
+WVPASS bup help save
+WVPASS bup save --help
+WVPASSEQ 1 $(bup help save | head -1 | grep -cF 'bup-save(1)')
+WVPASSEQ 1 $(bup save --help | head -1 | grep -cF 'bup-save(1)')
+
+WVPASS rm -rf "$tmpdir"