]> diplodocus.org Git - nmh/blobdiff - test/post/test-messageid
Document the -port flag. Text copied from inc.man .
[nmh] / test / post / test-messageid
index 45f75d0cdc5825ac5ed3bce58c0774396fcbf47d..ff1e72f59a84304c6184e5d9332c6dfc4c847921 100755 (executable)
@@ -32,6 +32,8 @@ DATA
 From: Mr Nobody <nobody@example.com>
 To: Somebody Else <somebody@example.com>
 Subject: Test
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
 Date:
 
 This is a test
@@ -40,6 +42,7 @@ QUIT
 EOF
 
 # check invalid -messageid selection
+start_test "invalid -messageid selection"
 run_test "send -draft -messageid invalid" \
 "post: unsupported messageid \"invalid\"
 send: message not delivered to anyone"
@@ -47,7 +50,7 @@ send: message not delivered to anyone"
 #### Rely on sendmail/pipe below to override default mts.
 mts_fakesendmail="${MHMTSCONF}-fakesendmail"
 cp "${MHMTSCONF}" "$mts_fakesendmail"
-printf "%s\n" "sendmail: ${srcdir}/test/fakesendmail" >>"$mts_fakesendmail"
+printf 'sendmail: %s/test/fakesendmail\n' "$srcdir" >>"$mts_fakesendmail"
 MHMTSCONF="$mts_fakesendmail"
 
 # $1: -messageid switch selection
@@ -55,13 +58,13 @@ MHMTSCONF="$mts_fakesendmail"
 test_messageid ()
 {
   msgid_style="$1"
-  send -draft -mts sendmail/pipe -msgid -messageid "$msgid_style"
+  run_prog send -draft -mts sendmail/pipe -msgid -messageid "$msgid_style"
   shift
 
   # 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"
 
   n=1
   for expected in "$@"; do
@@ -77,15 +80,15 @@ test_messageid ()
         # e.g., Message-ID: <5364-1342884222.165897@ldYM.FXwU.bBqK>
         id='^Message-ID: <[0-9]\{1,\}-[0-9]\{1,\}\.[0-9]\{6,6\}@[-_0-9A-Za-z]\{4,4\}\.[-_0-9A-Za-z]\{4,4\}\.[-_0-9A-Za-z]\{4,4\}'
         ;;
-      *)         printf "$0: unexpected messageid: $msgid_style"; exit 1;;
+      *) printf '%s: unexpected messageid: %s\n' "$0" "$msgid_style"; exit 1 ;;
     esac
 
     if grep "$id" "$cur" >/dev/null; then
       :
     else
       mv "$cur" "${testname}.actual"
-      printf "$0: unexpected "$msgid_style" Message-ID format, \
-see ${testname}.actual\n"
+      printf '%s: unexpected %s Message-ID format, see %s\n' "$0" \
+             "$msgid_style" "${testname}.actual"
       exit 1
     fi
 
@@ -109,6 +112,7 @@ see ${testname}.actual\n"
 }
 
 # check -messageid localname (the default)
+start_test "-messageid localname (the default)"
 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
 From: Mr Nobody <nobody@example.com>
 To: Somebody Else <somebody@example.com>
@@ -122,6 +126,8 @@ cat > "${testname}.expected" <<EOF
 From: Mr Nobody <nobody@example.com>
 To: Somebody Else <somebody@example.com>
 Subject: Test
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
 Date:
 Message-ID:
 
@@ -132,6 +138,7 @@ EOF
 test_messageid localname "${testname}.expected"
 
 # check -messageid random
+start_test "-messageid random"
 cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
 From: Mr Nobody <nobody@example.com>
 To: Somebody Else <somebody@example.com>
@@ -145,6 +152,8 @@ cat > "${testname}.expected" <<EOF
 From: Mr Nobody <nobody@example.com>
 To: Somebody Else <somebody@example.com>
 Subject: Test
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
 Date:
 Message-ID:
 
@@ -157,4 +166,5 @@ test_messageid random "${testname}.expected"
 
 rm -f ${MHMTSCONF}
 
+finish_test
 exit ${failed:-0}