]> diplodocus.org Git - nmh/blobdiff - test/mhbuild/test-ext-params
Don't clobber "cp"; use dp instead.
[nmh] / test / mhbuild / test-ext-params
index 58c2ff70e4c5a7eb605a76cc8c9da647601420e2..adde9d958da27bf0fba2e8c2f7c0f4833b0695b2 100755 (executable)
@@ -17,6 +17,7 @@ setup_test
 LC_ALL=en_US.UTF-8; export LC_ALL
 
 draft="$MH_TEST_DIR/$$.draft"
+backup="${MH_TEST_DIR}/`mhparam sbackup`$$.draft.orig"
 expected="$MH_TEST_DIR/$$.expected"
 
 #
@@ -89,8 +90,8 @@ This is a test message
 ------- =_aaaaaaaaaa0
 Content-Type: image/jpeg
 Content-Disposition: attachment;
-       filename*0="This is an example of a rather long filename that is lon";
-       filename*1="ger than would fit on a normal line.jpg"
+       filename*0="This is an example of a rather long filename that is lo";
+       filename*1="nger than would fit on a normal line.jpg"
 Content-Transfer-Encoding: base64
 
 /9g=
@@ -100,4 +101,130 @@ EOF
 
 check "$draft" "$expected"
 
+#
+# Try out attach with a filename with 8-bit characters
+#
+
+cp "${srcdir}/test/mhbuild/tiny.jpg" "$MH_TEST_DIR/tïny.jpg"
+
+cat > "$draft" <<EOF
+To: Mr Test <mrtest@example.com>
+cc:
+Fcc: +outbox
+Attach: $MH_TEST_DIR/tïny.jpg
+------
+This is a test message
+EOF
+
+run_prog mhbuild "$draft"
+
+cat > "$expected" <<EOF
+To: Mr Test <mrtest@example.com>
+cc:
+Fcc: +outbox
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
+
+------- =_aaaaaaaaaa0
+Content-Type: text/plain; charset="us-ascii"
+
+This is a test message
+
+------- =_aaaaaaaaaa0
+Content-Type: image/jpeg; name*=UTF-8''t%C3%AFny.jpg
+Content-Description: =?UTF-8?B?dMOvbnkuanBn?=
+Content-Disposition: attachment; filename*=UTF-8''t%C3%AFny.jpg
+Content-Transfer-Encoding: base64
+
+/9g=
+
+------- =_aaaaaaaaaa0--
+EOF
+
+check "$draft" "$expected"
+
+#
+# Alternate version; specify a disposion, but not an explicit filename
+#
+
+cat > "$draft" <<EOF
+To: Mr Test <mrtest@example.com>
+cc:
+Fcc: +outbox
+------
+This is a test message
+#image/jpeg {attachment} $MH_TEST_DIR/tïny.jpg
+EOF
+
+run_prog mhbuild "$draft"
+rm -f "$MH_TEST_DIR/tïny.jpg"
+
+cat > "$expected" <<EOF
+To: Mr Test <mrtest@example.com>
+cc:
+Fcc: +outbox
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
+
+------- =_aaaaaaaaaa0
+Content-Type: text/plain; charset="us-ascii"
+
+This is a test message
+
+------- =_aaaaaaaaaa0
+Content-Type: image/jpeg
+Content-Disposition: attachment; filename*=UTF-8''t%C3%AFny.jpg
+Content-Transfer-Encoding: base64
+
+/9g=
+
+------- =_aaaaaaaaaa0--
+EOF
+
+check "$draft" "$expected"
+
+#
+# Test out message/external-body decoding
+#
+
+cat > "$draft" <<EOF
+To: Mr Test <mrtest@example.com>
+cc:
+Fcc: +outbox
+------
+This is a test message
+#@application/octet-stream [Test of a long URL] {attachment; \
+filename=test.tar.gz} access-type=url; url="http://www.example.com/this/is/an/example/of/a/very/long/url/that-should-be-wrapped/name.tar.gz"
+EOF
+
+run_prog mhbuild "$draft"
+
+cat > "$expected" <<EOF
+To: Mr Test <mrtest@example.com>
+cc:
+Fcc: +outbox
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
+
+------- =_aaaaaaaaaa0
+Content-Type: text/plain; charset="us-ascii"
+
+This is a test message
+
+------- =_aaaaaaaaaa0
+Content-Type: message/external-body; access-type="url";
+       url*0="http://www.example.com/this/is/an/example/of/a/very/long/url";
+       url*1="/that-should-be-wrapped/name.tar.gz"
+
+Content-Type: application/octet-stream
+Content-Description: Test of a long URL
+Content-Disposition: attachment; filename="test.tar.gz"
+
+------- =_aaaaaaaaaa0--
+EOF
+
+check "$draft" "$expected"
+
+[ ${failed:=0} -eq 0 ]  &&  rm -f ${backup}
+
 exit ${failed:-0}