]> diplodocus.org Git - nmh/blobdiff - test/mhmail/test-mhmail
Changed -header-field to -headerfield. And refer to its argument
[nmh] / test / mhmail / test-mhmail
index 422c647dc959b6669bc3db4caf61f2a46c39ed29..0877d06ef16fc7f41c6f95fdb6f6b25fda5a7960 100755 (executable)
@@ -57,7 +57,8 @@ test_mhmail ()
 
     sed -e 's/^Date:.*/Date:/' \
         -e 's/^Resent-Date:.*/Resent-Date:/' \
-        -e 's/^Message-ID:.*/Message-ID:/' "$actual" > "$actual".nodate
+        -e 's/^Message-ID:.*/Message-ID:/' \
+        -e 's/^Content-ID:.*/Content-ID:/' "$actual" > "$actual".nodate
     rm -f "$actual"
 
     check "$actual".nodate "$1"
@@ -74,10 +75,11 @@ actual_err=$MH_TEST_DIR/test-mhmail$$.actual_err
 cat >$expected <<EOF
 Usage: mhmail [addrs ... [switches]]
   switches are:
+  -at(tach) file [-at(tach) file] ...
   -b(ody) text
   -c(c) addrs ...
   -f(rom) addr
-  -hea(der-field) name:field [-hea(der-field) name:field] ...
+  -hea(derfield) name:value [-hea(derfield) name:value] ...
   -su(bject) text
   -r(esent)
   -pr(ofile)
@@ -688,7 +690,7 @@ please resend this message, 3'
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 
-# check -header-field.
+# check -headerfield.
 # Not supported by compiled mhmail.
 cat > "$expected" <<EOF
 EHLO nosuchhost.example.com
@@ -706,13 +708,13 @@ QUIT
 EOF
 
 test_mhmail "$expected" \
-  '-from sender@example.com -header-field User-Agent:nmh' \
+  '-from sender@example.com -headerfield User-Agent:nmh' \
   -b 'with added header field'
 
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 
-# check multiple -header-fields.
+# check multiple -headerfields.
 # Not supported by compiled mhmail.
 cat > "$expected" <<EOF
 EHLO nosuchhost.example.com
@@ -732,12 +734,53 @@ QUIT
 EOF
 
 test_mhmail "$expected" \
-  "-from sender@example.com -header-field MIME-Version:1.0 \
--header-field Content-Type:text/plain;charset=utf-8 \
--header-field Content-Transfer-Encoding:8bit" \
+  "-from sender@example.com -headerfield MIME-Version:1.0 \
+-headerfield Content-Type:text/plain;charset=utf-8 \
+-headerfield Content-Transfer-Encoding:8bit" \
   -b 'with added header fields'
 
 [ ${failed:-0} -eq 0 ] || exit ${failed:-0}
 
 
+# check -attach
+# Not supported by compiled mhmail.
+cat > "$expected" <<EOF
+EHLO nosuchhost.example.com
+MAIL FROM:<sender@example.com>
+RCPT TO:<recipient@example.com>
+DATA
+To: recipient@example.com
+From: sender@example.com
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
+Content-ID:
+Date:
+Message-ID:
+
+------- =_aaaaaaaaaa0
+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-Description: attachment.txt
+Content-Disposition: attachment; filename="attachment.txt"
+
+The future disappears into memory, With only a moment between,
+Forever dwells in that moment, hope is what remains to be seen
+Forever dwells in that moment, hope is what remains to be seen.
+
+------- =_aaaaaaaaaa0--
+.
+QUIT
+EOF
+
+test_mhmail "$expected" \
+  "-from sender@example.com -attach ${srcdir}/test/mhmail/attachment.txt" \
+  -b 'See how easy it is to add an attachment!'
+
+[ ${failed:-0} -eq 0 ] || exit ${failed:-0}
+
+
 exit ${failed:-0}