]>
diplodocus.org Git - nmh/blob - test/inc/test-msgchk
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 run_prog 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 run_prog 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 run_prog msgchk
-nodate -date | sed -e 's/last read on.*/last read on/' \
78 check
"$expected" "$actual"
81 run_test
'msgchk -nodate' 'You have new mail waiting'
83 # check -notify mail, when there is mail
84 run_test
'msgchk -notify mail -nodate' 'You have new mail waiting'
86 # check -notify nomail, when there is mail
87 run_test
'msgchk -notify nomail -nodate' 'You have new mail waiting'
89 # check -notify all, when there is mail
90 run_test
'msgchk -notify nomail -notify all -nodate' 'You have new mail waiting'
92 # check -nonotify mail, when there is mail
93 run_test
'msgchk -nonotify mail -nodate' ''
95 # check -nonotify nomail, when there is mail
96 run_test
'msgchk -nonotify nomail -nodate' 'You have new mail waiting'
98 # check -nonotify all, when there is mail
99 run_test
'msgchk -nonotify nomail -nonotify all -nodate' ''
103 # check -notify mail, when there is no mail
104 run_test
'msgchk -notify mail -nodate' "You don't have any mail waiting"
106 # check -notify nomail, when there is no mail
107 run_test
'msgchk -notify nomail -nodate' "You don't have any mail waiting"
109 # check -notify all, when there is no mail
110 run_test
'msgchk -notify nomail -nonotify all -nodate' ''
112 # check -nonotify mail, when there is no mail
113 run_test
'msgchk -nonotify mail -nodate' "You don't have any mail waiting"
115 # check -nonotify nomail, when there is no mail
116 run_test
'msgchk -nonotify nomail -nodate' ''
118 # check -nonotify all, when there is no mail
119 run_test
'msgchk -nonotify nomail -nonotify all -nodate' ''