2 ######################################################
6 ######################################################
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir=`dirname $0`/../..
12 MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
15 . "$MH_OBJ_DIR/test/common.sh"
19 # Use proper program, likely not the first one on PATH.
20 rcvdist="${MH_LIB_DIR}/rcvdist"
22 expected=$MH_TEST_DIR/$$.expected
23 actual=$MH_TEST_DIR/$$.actual
28 Usage: rcvdist [switches] [switches for postproc] address ...
35 $rcvdist -help >"$actual" 2>&1
36 check "$expected" "$actual"
41 * ) printf "$0: rcvdist -v generated unexpected output\n" >&2
42 failed=`expr ${failed:-0} + 1`;;
45 # check unknown switch
46 run_test "$rcvdist -nonexistent" \
47 'rcvdist: usage: rcvdist [switches] [switches for postproc] address ...'
49 # check with no switches
51 'rcvdist: usage: rcvdist [switches] [switches for postproc] address ...'
55 cat >"$MH_TEST_DIR/Mail/notpost" <<EOF
58 chmod u+x "$MH_TEST_DIR/Mail/notpost"
59 sed 's/postproc:.*/#:/' "$MH" > "${MH}-new"
60 printf "postproc: $MH_TEST_DIR/Mail/notpost\n" >>"${MH}-new"
61 mv -f "${MH}-new" "$MH"
63 #### An extra space gets inserted between each header field name
64 #### and body. That probably should be fixed.
65 cat > "$expected" <<EOF
66 From: Test1 <test1@example.com>
67 To: Some User <user@example.com>
68 Date: Fri, 29 Sep 2006 00:00:00
69 Subject: Testing message 1
70 Resent-To: recipient@example.com
72 This is message number 1
75 $rcvdist recipient@example.com < "$MH_TEST_DIR/Mail/inbox/1"
76 check "$expected" "$actual"
79 cat > "$expected" <<EOF
80 From: Test1 <test1@example.com>
81 To: Some User <user@example.com>
82 Date: Fri, 29 Sep 2006 00:00:00
83 Subject: Testing message 1
84 Resent-To: recipient@example.com
85 Resent-From: Some User <user@example.com>
87 This is message number 1
90 cat > "$MH_TEST_DIR/Mail/rcvdistcomps" <<'EOF'
91 %(lit)%(formataddr{addresses})\
92 %<(nonnull)%(void(width))%(putaddr Resent-To:)%>
93 %(lit)%(formataddr{to})\
94 %<(nonnull)%(void(width))%(putaddr Resent-From:)\n%>
97 $rcvdist -form "$MH_TEST_DIR/Mail/rcvdistcomps" recipient@example.com < \
98 "$MH_TEST_DIR/Mail/inbox/1"
99 check "$expected" "$actual"