]> diplodocus.org Git - nmh/blobdiff - test/post/test-post-aliases
Update XOAUTH2 documentation.
[nmh] / test / post / test-post-aliases
index 6030ad13e0d3f33edde8ead36926190043225787..fbec4bc0d89bdc49ec05a93bd1b4199e600ab8aa 100755 (executable)
@@ -22,12 +22,13 @@ named.list; one@example.com, two@example.com
 one: one@example.com
 two: two@example.com
 three: three@example.com
+four: Mister Four <four@example.com>
 EOF
 
 #### Rely on sendmail/smtp or sendmail/pipe below to override default mts.
 mts_fakesendmail="${MHMTSCONF}-fakesendmail"
 cp "${MHMTSCONF}" "$mts_fakesendmail"
-printf "sendmail: ${srcdir}/test/fakesendmail\n" >>"$mts_fakesendmail"
+printf 'sendmail: %s/test/fakesendmail\n' "$srcdir" >>"$mts_fakesendmail"
 MHMTSCONF="$mts_fakesendmail"
 
 # $1: -mts switch selection
@@ -35,12 +36,12 @@ MHMTSCONF="$mts_fakesendmail"
 test_alias ()
 {
   if [ "$1" = 'sendmail/smtp' ]; then
-    send -draft -alias "${MH_TEST_DIR}/Mail/aliases" -mts sendmail/smtp
+    run_prog send -draft -alias "${MH_TEST_DIR}/Mail/aliases" -mts sendmail/smtp
 
     # 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"
+    rm -f "$mbox"
 
     # 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
@@ -56,23 +57,24 @@ test_alias ()
 
   elif [ "$1" = 'sendmail/pipe' ]; then
     set +e
-    send -draft -alias "${MH_TEST_DIR}/Mail/aliases" -mts sendmail/pipe \
-      >"${testname}.actual" 2>&1
+    run_prog send -draft -alias "${MH_TEST_DIR}/Mail/aliases" \
+      -mts sendmail/pipe >"${testname}.actual" 2>&1
     if [ $? -eq 0 ]; then
-      printf "$0: sendmail/pipe should have failed but didn't\n"
+      printf '%s: sendmail/pipe should have failed but didn'"'"'t\n' "$0"
     else
       set -e
       check "${testname}.actual" "$2"
     fi
 
   else
-    printf "$0: invalid -mts switch selection\n"
+    printf '%s: invalid -mts switch selection\n' "$0"
     exit 1
   fi
 }
 
 
 # check blind list
+start_test "blind list"
 cat >"${MH_TEST_DIR}/Mail/draft" <<EOF
 From: Mr Nobody <nobody@example.com>
 To: blind_list
@@ -86,6 +88,8 @@ cat >"${testname}.expected" <<EOF
 From: Mr Nobody <nobody@example.com>
 To: Blind List: ;
 Subject: blind list test
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
 Date:
 
 This is test of a blind list.
@@ -106,6 +110,8 @@ DATA
 From: Mr Nobody <nobody@example.com>
 To: Blind List: ;
 Subject: blind list test
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
 Date:
 
 This is test of a blind list.
@@ -117,6 +123,7 @@ test_post "${testname}.actual" "${testname}.expected" \
   "-alias ${MH_TEST_DIR}/Mail/aliases"
 
 # check named list (alias followed by ;)
+start_test "named list (alias followed by ;)"
 cat >"${MH_TEST_DIR}/Mail/draft" <<EOF
 From: Mr Nobody <nobody@example.com>
 To: named.list
@@ -129,6 +136,8 @@ cat >"${testname}.expected" <<EOF
 From: Mr Nobody <nobody@example.com>
 To: "named.list" <one@example.com>, "named.list" <two@example.com>
 Subject: named list test
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
 Date:
 
 This is test of a named list.
@@ -137,6 +146,7 @@ EOF
 test_alias sendmail/smtp "${testname}.expected"
 
 # check blind list with -mts sendmail/pipe, which should fail
+start_test "blind list with -mts sendmail/pipe, which should fail"
 cat >"${MH_TEST_DIR}/Mail/draft" <<EOF
 From: Mr Nobody <nobody@example.com>
 To: blind_list
@@ -152,5 +162,63 @@ EOF
 
 test_alias sendmail/pipe "${testname}.expected"
 
+# check that alias expansion happens in the From: line when doing a bcc
+start_test "that alias expansion happens in the From: line when doing a bcc"
+cat >"${MH_TEST_DIR}/Mail/draft" <<EOF
+From: four
+To: one
+Bcc: two
+Subject: from bcc expansion test
+
+This is test of from line expansion for a bcc.
+EOF
+
+cat >"${testname}.expected" <<EOF
+EHLO nosuchhost.example.com
+MAIL FROM:<four@example.com>
+RCPT TO:<one@example.com>
+RCPT TO:<two@example.com>
+RSET
+MAIL FROM:<four@example.com>
+RCPT TO:<one@example.com>
+DATA
+From: Mister Four <four@example.com>
+To: one@example.com
+Subject: from bcc expansion test
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
+Date:
+
+This is test of from line expansion for a bcc.
+.
+RSET
+MAIL FROM:<four@example.com>
+RCPT TO:<two@example.com>
+DATA
+From: Mister Four <four@example.com>
+Date:
+Subject: from bcc expansion test
+BCC:
+
+------- Blind-Carbon-Copy
+
+From: Mister Four <four@example.com>
+To: one@example.com
+Subject: from bcc expansion test
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
+Date:
+
+This is test of from line expansion for a bcc.
+
+------- End of Blind-Carbon-Copy
+.
+QUIT
+EOF
+
+test_post "${testname}.actual" "${testname}.expected" \
+  "-alias ${MH_TEST_DIR}/Mail/aliases"
+
 
+finish_test
 exit ${failed:-0}