]> diplodocus.org Git - nmh/blobdiff - test/mhmail/test-mhmail
Change test-mhmail so it can handle a MIMETYPEPROC that doesn't output
[nmh] / test / mhmail / test-mhmail
index 31d6689e6697ec2f088ba766590819798d6464ee..27188c77f42aa7f832fa619d7ec154ef4ec3a343 100755 (executable)
@@ -14,6 +14,19 @@ fi
 
 . "${srcdir}/test/post/test-post-common.sh"
 
 
 . "${srcdir}/test/post/test-post-common.sh"
 
+# Find MIME type string, using mimetypeproc if configured with it.
+MIMETYPEPROC=`mhparam mimetypeproc`
+content_type_string() {
+  if test -z "$MIMETYPEPROC"; then
+    echo "text/plain; name=\"`basename $1`\"; charset=\"us-ascii\""
+  else
+    # 1) Excise leading filename followed by : and any whitespace.
+    # 2) Wrap charset value in double quotes.  Assume that it isn't already.
+    printf "%s%s" \
+      `$MIMETYPEPROC $1` "; name=\"`basename $1`\"; charset=\"us-ascii\""
+  fi
+}
+
 # Customize test_post () for use with mhmail.
 # $1 is expected output file, provided by caller
 # $2 is mhmail switches, except for -body
 # Customize test_post () for use with mhmail.
 # $1 is expected output file, provided by caller
 # $2 is mhmail switches, except for -body
@@ -791,7 +804,7 @@ Content-Type: text/plain; charset="us-ascii"
 See how easy it is to add an attachment!
 
 ------- =_aaaaaaaaaa0
 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"
 
 Content-Description: attachment.txt
 Content-Disposition: attachment; filename="attachment.txt"