]>
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 check_exit
'-eq 1' msgchk
-
23 expected
=$MH_TEST_DIR/$$.expected
24 expected_err
=$MH_TEST_DIR/$$.expected_err
25 actual
=$MH_TEST_DIR/$$.actual
26 actual_err
=$MH_TEST_DIR/$$.actual_err
31 # Only look at first 9 lines because the rest depend on
32 # whether sasl support was configured in.
33 cat >"$expected" <<EOF
34 Usage: msgchk [switches] [users ...]
45 run_prog msgchk
-help 2>&1 | head -9 >"$actual"
46 check
"$expected" "$actual"
52 * ) printf '%s: msgchk -v generated unexpected output\n' "$0" >&2
53 failed
=`expr ${failed:-0} + 1`;;
56 # check unknown switch
57 start_test
"unknown switch"
58 run_test
"msgchk -nonexistent" 'msgchk: -nonexistent unknown'
60 # check with no arguments and no mail waiting
61 start_test
"with no arguments and no mail waiting"
62 run_test
'msgchk' "You don't have any mail waiting"
64 # Use maildrop specified in mts.conf, i.e.,
65 # ${MH_TEST_DIR}/Mail/maildrop, which should not yet exist.
66 "${MH_LIBEXEC_DIR}"/rcvpack
<"${MH_TEST_DIR}"/Mail
/inbox
/1 \
67 "${MH_TEST_DIR}"/Mail
/maildrop
69 # check with no arguments and mail waiting
70 start_test
"with no arguments and mail waiting"
71 cat >"$expected" <<EOF
72 You have new mail waiting; last read on
75 run_prog msgchk
| sed -e 's/last read on.*/last read on/' >"$actual"
76 check
"$expected" "$actual"
80 cat >"$expected" <<EOF
81 You have new mail waiting; last read on
84 run_prog msgchk
-nodate -date | sed -e 's/last read on.*/last read on/' \
86 check
"$expected" "$actual"
90 run_test
'msgchk -nodate' 'You have new mail waiting'
92 # check -notify mail, when there is mail
93 start_test
"-notify mail, when there is mail"
94 run_test
'msgchk -notify mail -nodate' 'You have new mail waiting'
96 # check -notify nomail, when there is mail
97 start_test
"-notify nomail, when there is mail"
98 run_test
'msgchk -notify nomail -nodate' 'You have new mail waiting'
100 # check -notify all, when there is mail
101 start_test
"-notify all, when there is mail"
102 run_test
'msgchk -notify nomail -notify all -nodate' 'You have new mail waiting'
104 # check -nonotify mail, when there is mail
105 start_test
"-nonotify mail, when there is mail"
106 run_test
'msgchk -nonotify mail -nodate' ''
108 # check -nonotify nomail, when there is mail
109 start_test
"-nonotify nomail, when there is mail"
110 run_test
'msgchk -nonotify nomail -nodate' 'You have new mail waiting'
112 # check -nonotify all, when there is mail
113 start_test
"-nonotify all, when there is mail"
114 run_test
'msgchk -nonotify nomail -nonotify all -nodate' ''
118 # check -notify mail, when there is no mail
119 start_test
"-notify mail, when there is no mail"
120 run_test
'msgchk -notify mail -nodate' "You don't have any mail waiting"
122 # check -notify nomail, when there is no mail
123 start_test
"-notify nomail, when there is no mail"
124 run_test
'msgchk -notify nomail -nodate' "You don't have any mail waiting"
126 # check -notify all, when there is no mail
127 start_test
"-notify all, when there is no mail"
128 run_test
'msgchk -notify nomail -nonotify all -nodate' ''
130 # check -nonotify mail, when there is no mail
131 start_test
"-nonotify mail, when there is no mail"
132 run_test
'msgchk -nonotify mail -nodate' "You don't have any mail waiting"
134 # check -nonotify nomail, when there is no mail
135 start_test
"-nonotify nomail, when there is no mail"
136 run_test
'msgchk -nonotify nomail -nodate' ''
138 # check -nonotify all, when there is no mail
139 start_test
"-nonotify all, when there is no mail"
140 run_test
'msgchk -nonotify nomail -nonotify all -nodate' ''