]> diplodocus.org Git - nmh/blobdiff - test/mhmail/test-mhmail
netsec_set_tls(): Return a value in the !TLS_SUPPORT && !tls case.
[nmh] / test / mhmail / test-mhmail
index 1caf0399711fcd6b49b376094dec6eaa427ed8f3..2e7375f0b6e087f9e9dae3542bdcd99bdca86c00 100755 (executable)
@@ -14,6 +14,21 @@ fi
 
 . "${srcdir}/test/post/test-post-common.sh"
 
+# Find MIME type string, using configured procs if available.
+MIMETYPEPROC=`mhparam mimetypeproc`
+MIMEENCODINGPROC=`mhparam mimeencodingproc`
+content_type_string() {
+  if test -z "$MIMETYPEPROC"  -o  -z "$MIMEENCODINGPROC"; then
+    #### This should be the order of name and charset.
+    echo "text/plain; name=\"`basename $1`\"; charset=\"us-ascii\""
+  else
+    #### Excise any leading filename followed by : and whitespace.
+    printf '%s; charset="%s"; name="%s"' \
+      `$MIMETYPEPROC $1 | sed -e 's/.*: *//'` \
+      `$MIMEENCODINGPROC $1 | sed -e 's/.*: *//'` `basename $1`
+  fi
+}
+
 # Customize test_post () for use with mhmail.
 # $1 is expected output file, provided by caller
 # $2 is mhmail switches, except for -body
@@ -73,8 +88,9 @@ Usage: mhmail [-t(o)] addrs ... [switches]
   mhmail with no arguments is equivalent to inc
 EOF
 
-mhmail -help >$actual 2>&1
-check $expected $actual
+#### Skip nmh intro text.
+mhmail -help | sed '/^$/,$d' >"$actual" 2>&1
+check "$expected" "$actual"
 
 
 # check -version
@@ -114,10 +130,6 @@ esac
 
 # check -nosend
 # Not supported by compiled mhmail.
-#### TEMPORARY hack to diagnose failure on Solaris.
-echo before
-sh -x mhmail -nosend recipient@example.com -from sender1@localhost -body '' 2>&1
-echo after
 mhmail -nosend recipient@example.com -from sender1@localhost \
   -server 127.0.0.1 -port $localport -body '' >"$actual" 2>"$actual_err"
 
@@ -281,6 +293,8 @@ RCPT TO:<recipient@example.com>
 DATA
 To: recipient@example.com
 From: sender8@localhost
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
 Date:
 Message-ID:
 
@@ -758,7 +772,7 @@ To: recipient@example.com
 From: sender27@example.com
 MIME-Version: 1.0
 Content-Type: text/plain;charset=utf-8
-Content-Transfer-Encoding: 8bit
+Content-Transfer-Encoding: 7bit
 Date:
 
 with added header fields
@@ -769,7 +783,7 @@ EOF
 test_mhmail "$expected" \
   "-from sender27@example.com -headerfield MIME-Version:1.0 \
 -headerfield Content-Type:text/plain;charset=utf-8 \
--headerfield Content-Transfer-Encoding:8bit" \
+-headerfield Content-Transfer-Encoding:7bit" \
   -b 'with added header fields'
 
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
@@ -795,7 +809,7 @@ Content-Type: text/plain; charset="us-ascii"
 See how easy it is to add an attachment!
 
 ------- =_aaaaaaaaaa0
-Content-Type: text/plain; name="attachment.txt"; charset="us-ascii"
+Content-Type: `content_type_string ${srcdir}/test/mhmail/attachment.txt`
 Content-Description: attachment.txt
 Content-Disposition: attachment; filename="attachment.txt"