]>
diplodocus.org Git - nmh/blob - test/mhbuild/test-ext-params
2 ######################################################
4 # Test the creation of RFC 2231 encoded parameters
6 ######################################################
8 if test -z "${MH_OBJ_DIR}"; then
9 srcdir
=`dirname "$0"`/..
/..
10 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
13 .
"$MH_OBJ_DIR/test/common.sh"
17 require_locale en_US.utf
-8 en_US.utf8
18 LC_ALL
=en_US.UTF
-8; export LC_ALL
20 draft
="$MH_TEST_DIR/$$.draft"
21 backup
="${MH_TEST_DIR}/`mhparam sbackup`$$.draft.orig"
22 expected
="$MH_TEST_DIR/$$.expected"
25 # Try out a draft with some 8-bit encoded parameters
29 To: Mr Test <mrtest@example.com>
33 This is a test message
34 #image/jpeg {attachment; filename="tïny.jpg"} ${srcdir}/test/mhbuild/tiny.jpg
37 run_prog mhbuild
"$draft"
39 cat > "$expected" <<EOF
40 To: Mr Test <mrtest@example.com>
44 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
47 Content-Type: text/plain; charset="us-ascii"
49 This is a test message
52 Content-Type: image/jpeg
53 Content-Disposition: attachment; filename*=UTF-8''t%C3%AFny.jpg
54 Content-Transfer-Encoding: base64
58 ------- =_aaaaaaaaaa0--
61 check
"$draft" "$expected"
64 # Try out a draft with some long parameters
68 To: Mr Test <mrtest@example.com>
72 This is a test message
73 #image/jpeg {attachment; filename="This is an example of a rather long filename that is longer than would fit on a normal line.jpg"} \
74 ${srcdir}/test/mhbuild/tiny.jpg
77 run_prog mhbuild
"$draft"
79 cat > "$expected" <<EOF
80 To: Mr Test <mrtest@example.com>
84 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
87 Content-Type: text/plain; charset="us-ascii"
89 This is a test message
92 Content-Type: image/jpeg
93 Content-Disposition: attachment;
94 filename*0="This is an example of a rather long filename that is lo";
95 filename*1="nger than would fit on a normal line.jpg"
96 Content-Transfer-Encoding: base64
100 ------- =_aaaaaaaaaa0--
103 check
"$draft" "$expected"
106 # Try out attach with a filename with 8-bit characters
109 cp "${srcdir}/test/mhbuild/tiny.jpg" "$MH_TEST_DIR/tïny.jpg"
112 To: Mr Test <mrtest@example.com>
115 Attach: $MH_TEST_DIR/tïny.jpg
117 This is a test message
120 run_prog mhbuild
"$draft"
122 cat > "$expected" <<EOF
123 To: Mr Test <mrtest@example.com>
127 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
129 ------- =_aaaaaaaaaa0
130 Content-Type: text/plain; charset="us-ascii"
132 This is a test message
134 ------- =_aaaaaaaaaa0
135 Content-Type: image/jpeg; name*=UTF-8''t%C3%AFny.jpg
136 Content-Description: =?UTF-8?B?dMOvbnkuanBn?=
137 Content-Disposition: attachment; filename*=UTF-8''t%C3%AFny.jpg
138 Content-Transfer-Encoding: base64
142 ------- =_aaaaaaaaaa0--
145 check
"$draft" "$expected"
148 # Alternate version; specify a disposion, but not an explicit filename
152 To: Mr Test <mrtest@example.com>
156 This is a test message
157 #image/jpeg {attachment} $MH_TEST_DIR/tïny.jpg
160 run_prog mhbuild
"$draft"
162 cat > "$expected" <<EOF
163 To: Mr Test <mrtest@example.com>
167 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
169 ------- =_aaaaaaaaaa0
170 Content-Type: text/plain; charset="us-ascii"
172 This is a test message
174 ------- =_aaaaaaaaaa0
175 Content-Type: image/jpeg
176 Content-Disposition: attachment; filename*=UTF-8''t%C3%AFny.jpg
177 Content-Transfer-Encoding: base64
181 ------- =_aaaaaaaaaa0--
184 check
"$draft" "$expected"
187 # Test to make sure things fail if we try to put 8-bit characters when the
192 To: Mr Test <mrtest@example.com>
196 This is a test message
197 #image/jpeg {attachment} $MH_TEST_DIR/tïny.jpg
201 LC_ALL
=C
; export LC_ALL
204 run_test
'eval mhbuild "$draft" 2>&1' 'mhbuild: 8-bit characters in parameter "filename", but local character set is US-ASCII'
207 LC_ALL
="$old_locale"; export LC_ALL
209 rm -f "$MH_TEST_DIR/tïny.jpg"
212 # Test out message/external-body decoding
216 To: Mr Test <mrtest@example.com>
220 This is a test message
221 #@application/octet-stream [Test of a long URL] {attachment; \
222 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"
225 run_prog mhbuild
"$draft"
227 cat > "$expected" <<EOF
228 To: Mr Test <mrtest@example.com>
232 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
234 ------- =_aaaaaaaaaa0
235 Content-Type: text/plain; charset="us-ascii"
237 This is a test message
239 ------- =_aaaaaaaaaa0
240 Content-Type: message/external-body; access-type="url";
241 url*0="http://www.example.com/this/is/an/example/of/a/very/long/url";
242 url*1="/that-should-be-wrapped/name.tar.gz"
244 Content-Type: application/octet-stream
245 Content-Description: Test of a long URL
246 Content-Disposition: attachment; filename="test.tar.gz"
248 ------- =_aaaaaaaaaa0--
251 check
"$draft" "$expected"
253 [ ${failed:=0} -eq 0 ] && rm -f ${backup}