X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/947be815882dfaa03916be0e7fb6b8721807829e..c99fde787781d43d2ada1e89d82a0e6a561656b6:/test/mhbuild/test-ext-params diff --git a/test/mhbuild/test-ext-params b/test/mhbuild/test-ext-params index e81ef47a..5be4514b 100755 --- a/test/mhbuild/test-ext-params +++ b/test/mhbuild/test-ext-params @@ -14,9 +14,10 @@ fi setup_test -LC_ALL=en_US.UTF-8; export LC_ALL +require_locale en_US.UTF-8 en_US.UTF8 en_US.utf-8 en_US.utf8 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= @@ -101,17 +102,58 @@ EOF check "$draft" "$expected" # -# Try out both! +# Try out attach with a filename with 8-bit characters # +cp "${srcdir}/test/mhbuild/tiny.jpg" "$MH_TEST_DIR/tïny.jpg" + cat > "$draft" < cc: Fcc: +outbox +Attach: $MH_TEST_DIR/tïny.jpg ------ This is a test message -#image/jpeg {attachment; filename="This is an ëxample of a rather long filename that is longer than would fit on a normal line.jpg"} \ -${srcdir}/test/mhbuild/tiny.jpg +EOF + +run_prog mhbuild "$draft" + +cat > "$expected" < +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" < +cc: +Fcc: +outbox +------ +This is a test message +#image/jpeg {attachment} $MH_TEST_DIR/tïny.jpg EOF run_prog mhbuild "$draft" @@ -130,9 +172,7 @@ 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" +Content-Disposition: attachment; filename*=UTF-8''t%C3%AFny.jpg Content-Transfer-Encoding: base64 /9g= @@ -142,4 +182,73 @@ EOF check "$draft" "$expected" +# +# Test to make sure things fail if we try to put 8-bit characters when the +# locale is US-ASCII +# + +cat > "$draft" < +cc: +Fcc: +outbox +------ +This is a test message +#image/jpeg {attachment} $MH_TEST_DIR/tïny.jpg +EOF + +old_locale="$LC_ALL" +LC_ALL=C; export LC_ALL + +set +e +run_test 'eval mhbuild "$draft" 2>&1' 'mhbuild: 8-bit characters in parameter "filename", but local character set is US-ASCII' +set -e + +LC_ALL="$old_locale"; export LC_ALL + +rm -f "$MH_TEST_DIR/tïny.jpg" + +# +# Test out message/external-body decoding +# + +cat > "$draft" < +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" < +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}