6d61de212d4eae8633561d07424d90146c873378
[mmh] / 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_LIB_DIR}/rcvtty"
21
22 expected="$MH_TEST_DIR/$$.expected"
23 actual="$MH_TEST_DIR/$$.actual"
24
25
26 # check -help
27 cat >"$expected" <<EOF
28 Usage: rcvtty [command ...]
29   switches are:
30   -biff
31   -form formatfile
32   -(forma)t string
33   -width columns
34   -[no]newline
35   -[no]bell
36   -version
37   -help
38 EOF
39
40 $rcvtty -help >"$actual" 2>&1
41 check "$expected" "$actual"
42
43 # check -version
44 case `$rcvtty -v` in
45   rcvtty\ --*) ;;
46   *          ) printf "$0: rcvtty -v generated unexpected output\n" >&2
47                failed=`expr ${failed:-0} + 1`;;
48 esac
49
50 # check normal operation.  Use -biff to avoid sending notification to
51 # each of the user's terminals.  So this command shouldn't do
52 # anything.  It will write the notification(s) if the user actually
53 # has actually enabled biff notification, or has set the exec bit of
54 # any of their ttys.
55 cat >"$expected" <<EOF
56 EOF
57 $rcvtty <${MH_TEST_DIR}/Mail/inbox/1 -biff >"$actual" 2>&1
58 check "$expected" "$actual"
59
60
61 exit ${failed:-0}