2 ######################################################
6 ######################################################
13 runandcheck "rcvdist -help" <<!
14 Usage: rcvdist [switches] [switches for spost] address ...
25 * ) printf '%s: rcvdist -v generated unexpected output\n' "$0" >&2
26 failed=`expr ${failed:-0} + 1`;;
29 # check unknown switch
30 runandcheck "rcvdist -nonexistent" <<!
31 rcvdist: usage: rcvdist [switches] [switches for spost] address ...
34 # check with no switches
35 runandcheck "rcvdist" <<!
36 rcvdist: usage: rcvdist [switches] [switches for spost] address ...
41 ### FIXME: port the following tests to mmh
44 #### Use sendmail/pipe below to override default mts.
45 mts_fakesendmail="${MHMTSCONF}-fakesendmail"
46 sed -e 's/^mts:.*/mts: sendmail\/pipe/' "${MHMTSCONF}" > "$mts_fakesendmail"
47 printf 'sendmail: %s/test/fakesendmail\n' "$srcdir" >>"$mts_fakesendmail"
48 MHMTSCONF="$mts_fakesendmail"
50 # arguments: rcvdist switches
53 run_prog $rcvdist "$@"
55 # fakesendmail drops the message and any cc's into this mbox.
56 mbox="${MH_TEST_DIR}"/Mail/fakesendmail.mbox
57 inc -silent -file "$mbox"
58 rm -f "$mbox" "$mbox.map"
60 # It's hard to calculate the exact Date: header post is going to
61 # use, so we'll just use sed to remove the actual date so we can
62 # easily compare it against our "correct" output.
63 sed -e 's/^Resent-Date:.*/Resent-Date:/' `mhpath last` > "$actual"
65 check "$expected" "$actual"
69 cat > "$expected" <<EOF
70 From: Test1 <test1@example.com>
71 To: Some User <user@example.com>
72 Date: Fri, 29 Sep 2006 00:00:00
73 Message-Id: 1@test.nmh
74 Subject: Testing message 1
75 Resent-From: `${MH_LIBEXEC_DIR}/ap -format '%(localmbox)' 0 | \
76 sed 's/^<\(.*\)>$/\1/'`
77 Resent-To: recipient@example.com
80 This is message number 1
83 test_rcvdist recipient@example.com < "$MH_TEST_DIR/Mail/inbox/1"
86 cat > "$expected" <<EOF
87 From: Test2 <test2@example.com>
88 To: Some User <user@example.com>
89 Date: Fri, 29 Sep 2006 00:00:00
90 Message-Id: 2@test.nmh
91 Subject: Testing message 2
92 Resent-To: recipient@example.com
93 Resent-From: Some User <user@example.com>
96 This is message number 2
99 cat > "$MH_TEST_DIR/Mail/rcvdistcomps" <<'EOF'
100 %(lit)%(formataddr{addresses})\
101 %<(nonnull)%(void(width))%(putaddr Resent-To:)%>
102 %(lit)%(formataddr{to})\
103 %<(nonnull)%(void(width))%(putaddr Resent-From:)\n%>
106 test_rcvdist -form "$MH_TEST_DIR/Mail/rcvdistcomps" recipient@example.com \
107 < "$MH_TEST_DIR/Mail/inbox/2"