]> diplodocus.org Git - nmh/blob - test/rcv/test-rcvtty
Replace getcpy() with mh_xstrdup() where the string isn't NULL.
[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 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 #### Skip nmh intro text.
41 run_prog "$rcvtty" -help | sed '/^$/,$d' >"$actual" 2>&1
42 check "$expected" "$actual"
43
44 # check -version
45 case `$rcvtty -v` in
46 rcvtty\ --*) ;;
47 * ) printf '%s: rcvtty -v generated unexpected output\n' "$0" >&2
48 failed=`expr ${failed:-0} + 1`;;
49 esac
50
51 # check normal operation. Use -biff to avoid sending notification to
52 # each of the user's terminals. So this command shouldn't do
53 # anything. It will write the notification(s) if the user actually
54 # has actually enabled biff notification, or has set the exec bit of
55 # any of their ttys.
56 cat >"$expected" <<EOF
57 EOF
58 run_prog $rcvtty <${MH_TEST_DIR}/Mail/inbox/1 -biff >"$actual" 2>&1
59 check "$expected" "$actual"
60
61
62 exit ${failed:-0}