]>
diplodocus.org Git - nmh/blob - test/mhbuild/test-attach
2 ######################################################
4 # Test the use of the Attach: header
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 expected
="$MH_TEST_DIR/$$.expected"
23 # Test out a simple draft, one part.
27 To: Mr Test <mrtest@example.com>
30 Attach: ${srcdir}/test/mhbuild/tiny.jpg
34 run_prog mhbuild
"$draft"
36 cat > "$expected" <<EOF
37 To: Mr Test <mrtest@example.com>
41 Content-Type: image/jpeg; name="tiny.jpg"
42 Content-Description: tiny.jpg
43 Content-Disposition: attachment; filename="tiny.jpg"
44 Content-Transfer-Encoding: base64
49 check
"$draft" "$expected"
52 # Check out more common case, one (or more) attachments
53 # along with message text.
57 To: Mr Test <mrtest@example.com>
60 Attach: ${srcdir}/test/mhbuild/tiny.jpg
65 run_prog mhbuild
"$draft"
67 cat > "$expected" <<EOF
68 To: Mr Test <mrtest@example.com>
72 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
75 Content-Type: text/plain; charset="us-ascii"
80 Content-Type: image/jpeg; name="tiny.jpg"
81 Content-Description: tiny.jpg
82 Content-Disposition: attachment; filename="tiny.jpg"
83 Content-Transfer-Encoding: base64
87 ------- =_aaaaaaaaaa0--
90 check
"$draft" "$expected"
93 # An empty Attach header
97 To: Mr Test <mrtest@example.com>
102 This is a test of an empty attach header.
105 run_prog mhbuild
"$draft"
107 cat > "$expected" <<EOF
108 To: Mr Test <mrtest@example.com>
112 Content-Type: text/plain; charset="us-ascii"
114 This is a test of an empty attach header.
117 check
"$draft" "$expected"
120 # Check a completely empty message
124 To: Mr Test <mrtest@example.com>
127 Subject: Test of an empty body
130 run_prog mhbuild
"$draft"
132 cat > "$expected" <<EOF
133 To: Mr Test <mrtest@example.com>
136 Subject: Test of an empty body
138 Content-Type: text/plain
141 check
"$draft" "$expected"
144 # Make sure we fail if we run into a MIME-Version header
148 To: Mr Test <mrtest@example.com>
151 Subject: Test of an already-MIMEified message
153 Content-Type: text/plain; charset="us-ascii"
155 This is a preformatted MIME content test.
159 run_test
'eval mhbuild "$draft"' "mhbuild: draft shouldn't contain MIME-Version: field"
163 # Run it again using -auto
166 run_prog mhbuild
-auto "$draft"
168 cat > "$expected" <<EOF
169 To: Mr Test <mrtest@example.com>
172 Subject: Test of an already-MIMEified message
174 Content-Type: text/plain; charset="us-ascii"
176 This is a preformatted MIME content test.
179 check
"$draft" "$expected"
182 # Make sure -dist does nothing but encode headers
186 To: Señor Test <mrtest@example.com>
189 Subject: An empty dist test
192 run_prog mhbuild
-dist "$draft"
194 cat > "$expected" <<EOF
195 To: =?UTF-8?Q?Se=C3=B1or_Test?= <mrtest@example.com>
198 Subject: An empty dist test
201 check
"$draft" "$expected"
204 # Two parts, one attachment; make sure mixing of multiparts at different
209 To: Mr Test <mrtest@example.com>
212 Subject: A more complete multipart test
213 Attach: ${srcdir}/test/mhbuild/tiny.jpg
221 This is some HTML tëxt.
227 run_prog mhbuild
"$draft"
229 cat > "$expected" <<EOF
230 To: Mr Test <mrtest@example.com>
233 Subject: A more complete multipart test
235 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
237 ------- =_aaaaaaaaaa0
238 Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa1"
240 ------- =_aaaaaaaaaa1
241 Content-Type: text/plain; charset="UTF-8"
242 Content-Transfer-Encoding: quoted-printable
244 This is some t=C3=ABxt.
246 ------- =_aaaaaaaaaa1
247 Content-Type: text/html; charset="UTF-8"
248 Content-Transfer-Encoding: quoted-printable
252 This is some HTML t=C3=ABxt.
256 ------- =_aaaaaaaaaa1--
258 ------- =_aaaaaaaaaa0
259 Content-Type: image/jpeg; name="tiny.jpg"
260 Content-Description: tiny.jpg
261 Content-Disposition: attachment; filename="tiny.jpg"
262 Content-Transfer-Encoding: base64
266 ------- =_aaaaaaaaaa0--
269 check
"$draft" "$expected"