From f07eb0cd7911559ffc47f4ad4ac9ddb49a0de678 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Sat, 8 Aug 2020 11:40:54 -0500 Subject: [PATCH] Add trivial tests for current help behavior Signed-off-by: Rob Browning Tested-by: Rob Browning --- Makefile | 1 + t/test-help | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 t/test-help diff --git a/Makefile b/Makefile index 57f13d1..d96c149 100644 --- 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 index 0000000..a68b5a0 --- /dev/null +++ b/t/test-help @@ -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" -- 2.39.2