#!/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"