]>
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
30 # Only look at first 9 lines because the rest depend on
31 # whether sasl support was configured in.
32 cat >"$expected" <<EOF
33 Usage: msgchk [switches] [users ...]
44 run_prog msgchk
-help 2>&1 | head -9 >"$actual"
45 check
"$expected" "$actual"
50 * ) printf '%s: msgchk -v generated unexpected output\n' "$0" >&2
51 failed
=`expr ${failed:-0} + 1`;;
54 # check unknown switch
55 run_test
"msgchk -nonexistent" 'msgchk: -nonexistent unknown'
57 # check with no arguments and no mail waiting
58 run_test
'msgchk' "You don't have any mail waiting"
60 # Use maildrop specified in mts.conf, i.e.,
61 # ${MH_TEST_DIR}/Mail/maildrop, which should not yet exist.
62 "${MH_LIBEXEC_DIR}"/rcvpack
<"${MH_TEST_DIR}"/Mail
/inbox
/1 \
63 "${MH_TEST_DIR}"/Mail
/maildrop
65 # check with no arguments and mail waiting
66 cat >"$expected" <<EOF
67 You have new mail waiting; last read on
70 run_prog msgchk
| sed -e 's/last read on.*/last read on/' >"$actual"
71 check
"$expected" "$actual"
74 cat >"$expected" <<EOF
75 You have new mail waiting; last read on
78 run_prog msgchk
-nodate -date | sed -e 's/last read on.*/last read on/' \
80 check
"$expected" "$actual"
83 run_test
'msgchk -nodate' 'You have new mail waiting'
85 # check -notify mail, when there is mail
86 run_test
'msgchk -notify mail -nodate' 'You have new mail waiting'
88 # check -notify nomail, when there is mail
89 run_test
'msgchk -notify nomail -nodate' 'You have new mail waiting'
91 # check -notify all, when there is mail
92 run_test
'msgchk -notify nomail -notify all -nodate' 'You have new mail waiting'
94 # check -nonotify mail, when there is mail
95 run_test
'msgchk -nonotify mail -nodate' ''
97 # check -nonotify nomail, when there is mail
98 run_test
'msgchk -nonotify nomail -nodate' 'You have new mail waiting'
100 # check -nonotify all, when there is mail
101 run_test
'msgchk -nonotify nomail -nonotify all -nodate' ''
105 # check -notify mail, when there is no mail
106 run_test
'msgchk -notify mail -nodate' "You don't have any mail waiting"
108 # check -notify nomail, when there is no mail
109 run_test
'msgchk -notify nomail -nodate' "You don't have any mail waiting"
111 # check -notify all, when there is no mail
112 run_test
'msgchk -notify nomail -nonotify all -nodate' ''
114 # check -nonotify mail, when there is no mail
115 run_test
'msgchk -nonotify mail -nodate' "You don't have any mail waiting"
117 # check -nonotify nomail, when there is no mail
118 run_test
'msgchk -nonotify nomail -nodate' ''
120 # check -nonotify all, when there is no mail
121 run_test
'msgchk -nonotify nomail -nonotify all -nodate' ''