]> diplodocus.org Git - nmh/blobdiff - test/mhmail/test-mhmail
Print pointers in debug with C99's `%p' rather than `0x%x'.
[nmh] / test / mhmail / test-mhmail
index c773c04180637dddb0fd0182654a897ac070013b..2e7375f0b6e087f9e9dae3542bdcd99bdca86c00 100755 (executable)
@@ -14,17 +14,18 @@ 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.
+# Find MIME type string, using configured procs if available.
 MIMETYPEPROC=`mhparam mimetypeproc`
 MIMETYPEPROC=`mhparam mimetypeproc`
+MIMEENCODINGPROC=`mhparam mimeencodingproc`
 content_type_string() {
 content_type_string() {
-  if test -z "$MIMETYPEPROC"; then
+  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
     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%s" \
-      `$MIMETYPEPROC $1 | sed -e 's/.*: *//' -e 's/\(charset=\)\(.*\)/\1"\2"/'`\
-      "; name=\"`basename $1`\""
+    #### 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
 }
 
   fi
 }
 
@@ -87,8 +88,9 @@ Usage: mhmail [-t(o)] addrs ... [switches]
   mhmail with no arguments is equivalent to inc
 EOF
 
   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
 
 
 # check -version
@@ -291,6 +293,8 @@ RCPT TO:<recipient@example.com>
 DATA
 To: recipient@example.com
 From: sender8@localhost
 DATA
 To: recipient@example.com
 From: sender8@localhost
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
 Date:
 Message-ID:
 
 Date:
 Message-ID:
 
@@ -768,7 +772,7 @@ To: recipient@example.com
 From: sender27@example.com
 MIME-Version: 1.0
 Content-Type: text/plain;charset=utf-8
 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
 Date:
 
 with added header fields
@@ -779,7 +783,7 @@ EOF
 test_mhmail "$expected" \
   "-from sender27@example.com -headerfield MIME-Version:1.0 \
 -headerfield Content-Type:text/plain;charset=utf-8 \
 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}
   -b 'with added header fields'
 
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}