]> arthur.barton.de Git - bup.git/blob - t/test-help
test-help: restrict MANPATH; only test manpages when available
[bup.git] / t / test-help
1 #!/usr/bin/env bash
2 . ./wvtest-bup.sh
3
4 set -o pipefail
5
6 top="$(WVPASS pwd)" || exit $?
7 tmpdir="$(WVPASS wvmktempdir)" || exit $?
8 export BUP_DIR="$tmpdir/bup"
9 export GIT_DIR="$tmpdir/bup"
10
11 bup() { "$top/bup" "$@"; }
12
13 # FIXME: send help to stdout if requested (exit 0), stderr on error
14 # (exit nonzero)
15
16 bup -?
17 rc=$?
18 WVPASSEQ 99 "$rc"
19
20 bup --help
21 rc=$?
22 WVPASSEQ 99 "$rc"
23
24 if ! test -e Documentation/bup-save.1; then
25     WVPASS rm -rf "$tmpdir"
26     exit 0
27 fi
28
29 mkdir -p "$tmpdir/man"
30 (cd "$tmpdir/man" && ln -s "$top/Documentation" man1)
31 export MANPATH="$tmpdir/man"
32
33 WVPASS bup help save
34 WVPASS bup save --help
35 WVPASSEQ 1 $(bup help save | head -1 | grep -cF 'bup-save(1)')
36 WVPASSEQ 1 $(bup save --help | head -1 | grep -cF 'bup-save(1)')
37
38 WVPASS rm -rf "$tmpdir"