]>
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 LC_ALL
=en_US.UTF
-8; export LC_ALL
19 draft
="$MH_TEST_DIR/$$.draft"
20 backup
="${MH_TEST_DIR}/`mhparam sbackup`$$.draft.orig"
21 expected
="$MH_TEST_DIR/$$.expected"
24 # Try out a draft with some 8-bit encoded parameters
28 To: Mr Test <mrtest@example.com>
32 This is a test message
33 #image/jpeg {attachment; filename="tïny.jpg"} ${srcdir}/test/mhbuild/tiny.jpg
36 run_prog mhbuild
"$draft"
38 cat > "$expected" <<EOF
39 To: Mr Test <mrtest@example.com>
43 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
46 Content-Type: text/plain; charset="us-ascii"
48 This is a test message
51 Content-Type: image/jpeg
52 Content-Disposition: attachment; filename*=UTF-8''t%C3%AFny.jpg
53 Content-Transfer-Encoding: base64
57 ------- =_aaaaaaaaaa0--
60 check
"$draft" "$expected"
63 # Try out a draft with some long parameters
67 To: Mr Test <mrtest@example.com>
71 This is a test message
72 #image/jpeg {attachment; filename="This is an example of a rather long filename that is longer than would fit on a normal line.jpg"} \
73 ${srcdir}/test/mhbuild/tiny.jpg
76 run_prog mhbuild
"$draft"
78 cat > "$expected" <<EOF
79 To: Mr Test <mrtest@example.com>
83 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
86 Content-Type: text/plain; charset="us-ascii"
88 This is a test message
91 Content-Type: image/jpeg
92 Content-Disposition: attachment;
93 filename*0="This is an example of a rather long filename that is lo";
94 filename*1="nger than would fit on a normal line.jpg"
95 Content-Transfer-Encoding: base64
99 ------- =_aaaaaaaaaa0--
102 check
"$draft" "$expected"
105 # Try out attach with a filename with 8-bit characters
108 cp "${srcdir}/test/mhbuild/tiny.jpg" "$MH_TEST_DIR/tïny.jpg"
111 To: Mr Test <mrtest@example.com>
114 Attach: $MH_TEST_DIR/tïny.jpg
116 This is a test message
119 run_prog mhbuild
"$draft"
121 cat > "$expected" <<EOF
122 To: Mr Test <mrtest@example.com>
126 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
128 ------- =_aaaaaaaaaa0
129 Content-Type: text/plain; charset="us-ascii"
131 This is a test message
133 ------- =_aaaaaaaaaa0
134 Content-Type: image/jpeg; name*=UTF-8''t%C3%AFny.jpg
135 Content-Description: =?UTF-8?B?dMOvbnkuanBn?=
136 Content-Disposition: attachment; filename*=UTF-8''t%C3%AFny.jpg
137 Content-Transfer-Encoding: base64
141 ------- =_aaaaaaaaaa0--
144 check
"$draft" "$expected"
147 # Alternate version; specify a disposion, but not an explicit filename
151 To: Mr Test <mrtest@example.com>
155 This is a test message
156 #image/jpeg {attachment} $MH_TEST_DIR/tïny.jpg
159 run_prog mhbuild
"$draft"
160 rm -f "$MH_TEST_DIR/tïny.jpg"
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 out message/external-body decoding
191 To: Mr Test <mrtest@example.com>
195 This is a test message
196 #@application/octet-stream [Test of a long URL] {attachment; \
197 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"
200 run_prog mhbuild
"$draft"
202 cat > "$expected" <<EOF
203 To: Mr Test <mrtest@example.com>
207 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
209 ------- =_aaaaaaaaaa0
210 Content-Type: text/plain; charset="us-ascii"
212 This is a test message
214 ------- =_aaaaaaaaaa0
215 Content-Type: message/external-body; access-type="url";
216 url*0="http://www.example.com/this/is/an/example/of/a/very/long/url";
217 url*1="/that-should-be-wrapped/name.tar.gz"
219 Content-Type: application/octet-stream
220 Content-Description: Test of a long URL
221 Content-Disposition: attachment; filename="test.tar.gz"
223 ------- =_aaaaaaaaaa0--
226 check
"$draft" "$expected"
228 [ ${failed:=0} -eq 0 ] && rm -f ${backup}