2 ######################################################
5 # Only tests checking of local maildrop, does not
6 # test checking of POP server.
8 ######################################################
12 if test -z "${MH_OBJ_DIR}"; then
13 srcdir=`dirname $0`/../..
14 MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
17 . "$MH_OBJ_DIR/test/common.sh"
21 expected=$MH_TEST_DIR/$$.expected
22 expected_err=$MH_TEST_DIR/$$.expected_err
23 actual=$MH_TEST_DIR/$$.actual
24 actual_err=$MH_TEST_DIR/$$.actual_err
28 # Only look at first 9 lines because the rest depend on
29 # whether sasl support was configured in.
30 cat >"$expected" <<EOF
31 Usage: msgchk [switches] [users ...]
42 msgchk -help | head -9 >"$actual" 2>&1
43 check "$expected" "$actual"
48 * ) printf '%s: msgchk -v generated unexpected output\n' "$0" >&2
49 failed=`expr ${failed:-0} + 1`;;
52 # check unknown switch
53 run_test "msgchk -nonexistent" 'msgchk: -nonexistent unknown'
55 # check with no arguments and no mail waiting
56 run_test 'msgchk' "You don't have any mail waiting"
58 # Use maildrop specified in mts.conf, i.e.,
59 # ${MH_TEST_DIR}/Mail/maildrop, which should not yet exist.
60 "${MH_LIB_DIR}"/rcvpack <"${MH_TEST_DIR}"/Mail/inbox/1 \
61 "${MH_TEST_DIR}"/Mail/maildrop
63 # check with no arguments and mail waiting
64 cat >"$expected" <<EOF
65 You have new mail waiting; last read on
68 msgchk | sed -e 's/last read on.*/last read on/' >"$actual"
69 check "$expected" "$actual"
72 cat >"$expected" <<EOF
73 You have new mail waiting; last read on
76 msgchk -nodate -date | sed -e 's/last read on.*/last read on/' >"$actual"
77 check "$expected" "$actual"
80 run_test 'msgchk -nodate' 'You have new mail waiting'
82 # check -notify mail, when there is mail
83 run_test 'msgchk -notify mail -nodate' 'You have new mail waiting'
85 # check -notify nomail, when there is mail
86 run_test 'msgchk -notify nomail -nodate' 'You have new mail waiting'
88 # check -notify all, when there is mail
89 run_test 'msgchk -notify nomail -notify all -nodate' 'You have new mail waiting'
91 # check -nonotify mail, when there is mail
92 run_test 'msgchk -nonotify mail -nodate' ''
94 # check -nonotify nomail, when there is mail
95 run_test 'msgchk -nonotify nomail -nodate' 'You have new mail waiting'
97 # check -nonotify all, when there is mail
98 run_test 'msgchk -nonotify nomail -nonotify all -nodate' ''
102 # check -notify mail, when there is no mail
103 run_test 'msgchk -notify mail -nodate' "You don't have any mail waiting"
105 # check -notify nomail, when there is no mail
106 run_test 'msgchk -notify nomail -nodate' "You don't have any mail waiting"
108 # check -notify all, when there is no mail
109 run_test 'msgchk -notify nomail -nonotify all -nodate' ''
111 # check -nonotify mail, when there is no mail
112 run_test 'msgchk -nonotify mail -nodate' "You don't have any mail waiting"
114 # check -nonotify nomail, when there is no mail
115 run_test 'msgchk -nonotify nomail -nodate' ''
117 # check -nonotify all, when there is no mail
118 run_test 'msgchk -nonotify nomail -nonotify all -nodate' ''