]> diplodocus.org Git - nmh/blob - test/rcv/test-rcvtty
Review inc.man.
[nmh] / test / rcv / test-rcvtty
1 #!/bin/sh
2 ######################################################
3 #
4 # Test rcvtty
5 #
6 ######################################################
7
8 set -e
9
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir=`dirname $0`/../..
12 MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
13 fi
14
15 . "$MH_OBJ_DIR/test/common.sh"
16
17 setup_test
18
19 # Use proper program, likely not the first one on PATH.
20 rcvtty="${MH_LIBEXEC_DIR}/rcvtty"
21
22 check_exit '-eq 1' $rcvtty -
23
24 expected="$MH_TEST_DIR/$$.expected"
25 actual="$MH_TEST_DIR/$$.actual"
26
27
28 # check -help
29 cat >"$expected" <<EOF
30 Usage: rcvtty [command ...]
31 switches are:
32 -biff
33 -form formatfile
34 -(forma)t string
35 -width columns
36 -[no]newline
37 -[no]bell
38 -version
39 -help
40 EOF
41
42 #### Skip nmh intro text.
43 run_prog "$rcvtty" -help | sed '/^$/,$d' >"$actual" 2>&1
44 check "$expected" "$actual"
45
46 # check -version
47 case `$rcvtty -v` in
48 rcvtty\ --*) ;;
49 * ) printf '%s: rcvtty -v generated unexpected output\n' "$0" >&2
50 failed=`expr ${failed:-0} + 1`;;
51 esac
52
53 # check normal operation. Use -biff to avoid sending notification to
54 # each of the user's terminals. So this command shouldn't do
55 # anything. It will write the notification(s) if the user actually
56 # has actually enabled biff notification, or has set the exec bit of
57 # any of their ttys.
58 cat >"$expected" <<EOF
59 EOF
60 run_prog $rcvtty <${MH_TEST_DIR}/Mail/inbox/1 -biff >"$actual" 2>&1
61 check "$expected" "$actual"
62
63
64 exit ${failed:-0}