X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=test%2Ftests%2Frcv%2Ftest-rcvdist;fp=test%2Ftests%2Frcv%2Ftest-rcvdist;h=8d05bc887414b4b032bf0a1e082b538632a6c338;hb=82325c1114254a76b8285bb710b2f651674331c7;hp=0000000000000000000000000000000000000000;hpb=9c61a657f72aa43b4a2f4e027ad84e7f65fb66cb;p=mmh diff --git a/test/tests/rcv/test-rcvdist b/test/tests/rcv/test-rcvdist new file mode 100755 index 0000000..8d05bc8 --- /dev/null +++ b/test/tests/rcv/test-rcvdist @@ -0,0 +1,108 @@ +#!/bin/sh +###################################################### +# +# Test rcvdist +# +###################################################### + +. "$MH_TEST_COMMON" + + + +# check -help +runandcheck "rcvdist -help" <&2 + failed=`expr ${failed:-0} + 1`;; +esac + +# check unknown switch +runandcheck "rcvdist -nonexistent" < "$mts_fakesendmail" +printf 'sendmail: %s/test/fakesendmail\n' "$srcdir" >>"$mts_fakesendmail" +MHMTSCONF="$mts_fakesendmail" + +# arguments: rcvdist switches +test_rcvdist () +{ + run_prog $rcvdist "$@" + + # fakesendmail drops the message and any cc's into this mbox. + mbox="${MH_TEST_DIR}"/Mail/fakesendmail.mbox + inc -silent -file "$mbox" + rm -f "$mbox" "$mbox.map" + + # It's hard to calculate the exact Date: header post is going to + # use, so we'll just use sed to remove the actual date so we can + # easily compare it against our "correct" output. + sed -e 's/^Resent-Date:.*/Resent-Date:/' `mhpath last` > "$actual" + + check "$expected" "$actual" +} + +# check with address +cat > "$expected" < +To: Some User +Date: Fri, 29 Sep 2006 00:00:00 +Message-Id: 1@test.nmh +Subject: Testing message 1 +Resent-From: `${MH_LIBEXEC_DIR}/ap -format '%(localmbox)' 0 | \ + sed 's/^<\(.*\)>$/\1/'` +Resent-To: recipient@example.com +Resent-Date: + +This is message number 1 +EOF + +test_rcvdist recipient@example.com < "$MH_TEST_DIR/Mail/inbox/1" + +# check -form +cat > "$expected" < +To: Some User +Date: Fri, 29 Sep 2006 00:00:00 +Message-Id: 2@test.nmh +Subject: Testing message 2 +Resent-To: recipient@example.com +Resent-From: Some User +Resent-Date: + +This is message number 2 +EOF + +cat > "$MH_TEST_DIR/Mail/rcvdistcomps" <<'EOF' +%(lit)%(formataddr{addresses})\ +%<(nonnull)%(void(width))%(putaddr Resent-To:)%> +%(lit)%(formataddr{to})\ +%<(nonnull)%(void(width))%(putaddr Resent-From:)\n%> +EOF + +test_rcvdist -form "$MH_TEST_DIR/Mail/rcvdistcomps" recipient@example.com \ + < "$MH_TEST_DIR/Mail/inbox/2" +