2 #########################################################
4 # Test the use of explicit Content-Transfer-Encoding tags
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"
19 require_locale en_US.UTF-8 en_US.UTF8 en_US.utf-8 en_US.utf8
21 draft
="$MH_TEST_DIR/$$.draft"
22 backup
="${MH_TEST_DIR}/`mhparam sbackup`$$.draft.orig"
23 expected
="$MH_TEST_DIR/$$.expected"
26 # Force some text to be quoted-printable
30 To: Mr Test <mrtest@example.com>
35 This is a test of a message with a shørt line.
38 cat > "$expected" <<EOF
39 To: Mr Test <mrtest@example.com>
43 Content-Type: text/plain; charset="UTF-8"
44 Content-Transfer-Encoding: quoted-printable
46 This is a test of a message with a sh=C3=B8rt line.
49 run_prog mhbuild
"$draft"
50 check
"$draft" "$expected"
53 # Force some text to be base64, to test out the encoder. Try at different
54 # line lengths to check out the padding on the routines to convert LF to
55 # CR LF. The current implementation reads in using a 3 byte buffer, so make
56 # sure we catch all of those cases.
60 To: Mr Test <mrtest@example.com>
65 This is a test of a message with a shørt line.
68 cat > "$expected" <<EOF
69 To: Mr Test <mrtest@example.com>
73 Content-Type: text/plain; charset="UTF-8"
74 Content-Transfer-Encoding: base64
76 VGhpcyBpcyBhIHRlc3Qgb2YgYSBtZXNzYWdlIHdpdGggYSBzaMO4cnQgbGluZS4NCg==
79 run_prog mhbuild
"$draft"
80 check
"$draft" "$expected"
83 To: Mr Test <mrtest@example.com>
88 This is a test of a mëssage with a shørt line.
91 cat > "$expected" <<EOF
92 To: Mr Test <mrtest@example.com>
96 Content-Type: text/plain; charset="UTF-8"
97 Content-Transfer-Encoding: base64
99 VGhpcyBpcyBhIHRlc3Qgb2YgYSBtw6tzc2FnZSB3aXRoIGEgc2jDuHJ0IGxpbmUuDQo=
102 run_prog mhbuild
"$draft"
103 check
"$draft" "$expected"
106 To: Mr Test <mrtest@example.com>
111 This is a test of a mëssäge with a shørt line.
114 cat > "$expected" <<EOF
115 To: Mr Test <mrtest@example.com>
119 Content-Type: text/plain; charset="UTF-8"
120 Content-Transfer-Encoding: base64
122 VGhpcyBpcyBhIHRlc3Qgb2YgYSBtw6tzc8OkZ2Ugd2l0aCBhIHNow7hydCBsaW5lLg0K
125 run_prog mhbuild
"$draft"
126 check
"$draft" "$expected"
129 To: Mr Test <mrtest@example.com>
134 This is a test of a message with a shørt line.
135 This is a second line.
138 cat > "$expected" <<EOF
139 To: Mr Test <mrtest@example.com>
143 Content-Type: text/plain; charset="UTF-8"
144 Content-Transfer-Encoding: base64
146 VGhpcyBpcyBhIHRlc3Qgb2YgYSBtZXNzYWdlIHdpdGggYSBzaMO4cnQgbGluZS4NClRoaXMgaXMg
147 YSBzZWNvbmQgbGluZS4NCg==
150 run_prog mhbuild
"$draft"
151 check
"$draft" "$expected"
154 To: Mr Test <mrtest@example.com>
159 This is a test of a mëssage with a shørt line.
160 This is a second line.
163 cat > "$expected" <<EOF
164 To: Mr Test <mrtest@example.com>
168 Content-Type: text/plain; charset="UTF-8"
169 Content-Transfer-Encoding: base64
171 VGhpcyBpcyBhIHRlc3Qgb2YgYSBtw6tzc2FnZSB3aXRoIGEgc2jDuHJ0IGxpbmUuDQpUaGlzIGlz
172 IGEgc2Vjb25kIGxpbmUuDQo=
175 run_prog mhbuild
"$draft"
176 check
"$draft" "$expected"
179 To: Mr Test <mrtest@example.com>
184 This is a test of a mëssäge with a shørt line.
185 This is a second line.
188 cat > "$expected" <<EOF
189 To: Mr Test <mrtest@example.com>
193 Content-Type: text/plain; charset="UTF-8"
194 Content-Transfer-Encoding: base64
196 VGhpcyBpcyBhIHRlc3Qgb2YgYSBtw6tzc8OkZ2Ugd2l0aCBhIHNow7hydCBsaW5lLg0KVGhpcyBp
197 cyBhIHNlY29uZCBsaW5lLg0K
200 run_prog mhbuild
"$draft"
201 check
"$draft" "$expected"
204 To: Mr Test <mrtest@example.com>
209 This is a test of a mëssäge with a shørt line.
212 This is a second line.
219 cat > "$expected" <<EOF
220 To: Mr Test <mrtest@example.com>
224 Content-Type: text/plain; charset="UTF-8"
225 Content-Transfer-Encoding: base64
227 VGhpcyBpcyBhIHRlc3Qgb2YgYSBtw6tzc8OkZ2Ugd2l0aCBhIHNow7hydCBsaW5lLg0KDQoNClRo
228 aXMgaXMgYSBzZWNvbmQgbGluZS4NCg0KDQoNCg0K
231 run_prog mhbuild
"$draft"
232 check
"$draft" "$expected"
235 # Test out some "long" text. By default it should end up as quoted-printable.
236 # But if we request 8bit we should error out if the line is greater than
241 To: Mr Test <mrtest@example.com>
245 This is a test of a messege with a long line. This line needs to be longer than 998 to test out the encoding rules. Will that work? That's a good question; I don't know if it will or not. I am the very model of a modern Major-General, I've information vegetable, animal, and mineral, I know the kings of England, and I quote the fights historical From Marathon to Waterloo, in order categorical, I'm very well acquainted, too, with matters mathematical, I understand equations, both the simple and quadratical, About binomial theorem I'm teeming with a lot o' news, With many cheerful facts about the square of the hypotenuse. I'm very good at integral and differential calculus; I know the scientific names of beings animalculous: In short, in matters vegetable, animal, and mineral, I am the very model of a modern Major-General. I know our mythic history, King Arthur's and Sir Caradoc's; I answer hard acrostics, I've a pretty taste for paradox, I quote in elegiacs all the crimes of Heliogabalus, In conics I can floor peculiarities parabolous; I can tell undoubted Raphaels from Gerard Dows and Zoffanies, I know the croaking chorus from The Frogs of Aristophanes! Then I can hum a fugue of which I've heard the music's din afore, And whistle all the airs from that infernal nonsense Pinafore.
247 This is a second line.
250 cat > "$expected" <<EOF
251 To: Mr Test <mrtest@example.com>
255 Content-Type: text/plain; charset="us-ascii"
256 Content-Transfer-Encoding: quoted-printable
258 This is a test of a messege with a long line. This line needs to be longe=
259 r than 998 to test out the encoding rules. Will that work? That's a good=
260 question; I don't know if it will or not. I am the very model of a moder=
261 n Major-General, I've information vegetable, animal, and mineral, I know t=
262 he kings of England, and I quote the fights historical From Marathon to Wa=
263 terloo, in order categorical, I'm very well acquainted, too, with matters =
264 mathematical, I understand equations, both the simple and quadratical, Abo=
265 ut binomial theorem I'm teeming with a lot o' news, With many cheerful fac=
266 ts about the square of the hypotenuse. I'm very good at integral and diffe=
267 rential calculus; I know the scientific names of beings animalculous: In s=
268 hort, in matters vegetable, animal, and mineral, I am the very model of a =
269 modern Major-General. I know our mythic history, King Arthur's and Sir Car=
270 adoc's; I answer hard acrostics, I've a pretty taste for paradox, I quote =
271 in elegiacs all the crimes of Heliogabalus, In conics I can floor peculiar=
272 ities parabolous; I can tell undoubted Raphaels from Gerard Dows and Zoffa=
273 nies, I know the croaking chorus from The Frogs of Aristophanes! Then I c=
274 an hum a fugue of which I've heard the music's din afore, And whistle all =
275 the airs from that infernal nonsense Pinafore. =
278 This is a second line.
281 run_prog mhbuild
"$draft"
282 check
"$draft" "$expected"
285 To: Mr Test <mrtest@example.com>
289 This is a test of a messege with a long line. This line needs to be longer than 998 to test out the encoding rules. Will that work? That's a good question; I don't know if it will or not. I am the very model of a modern Major-General, I've information vegetable, animal, and mineral, I know the kings of England, and I quote the fights historical From Marathon to Waterloo, in order categorical, I'm very well acquainted, too, with matters mathematical, I understand equations, both the simple and quadratical, About binomial theorem I'm teeming with a lot o' news, With many cheerful facts about the square of the hypotenuse. I'm very good at integral and differential calculus; I know the scientific names of beings animalculous: In short, in matters vegetable, animal, and mineral, I am the very model of a modern Major-General. I know our mythic history, King Arthur's and Sir Caradoc's; I answer hard acrostics, I've a pretty taste for paradox, I quote in elegiacs all the crimes of Heliogabalus, In conics I can floor peculiarities parabolous; I can tell undoubted Raphaels from Gerard Dows and Zoffanies, I know the croaking chorus from The Frogs of Aristophanes! Then I can hum a fugue of which I've heard the music's din afore, And whistle all the airs from that infernal nonsense Pinafore.
291 This is a secönd line.
294 cat > "$expected" <<EOF
295 To: Mr Test <mrtest@example.com>
299 Content-Type: text/plain; charset="UTF-8"
300 Content-Transfer-Encoding: quoted-printable
302 This is a test of a messege with a long line. This line needs to be longe=
303 r than 998 to test out the encoding rules. Will that work? That's a good=
304 question; I don't know if it will or not. I am the very model of a moder=
305 n Major-General, I've information vegetable, animal, and mineral, I know t=
306 he kings of England, and I quote the fights historical From Marathon to Wa=
307 terloo, in order categorical, I'm very well acquainted, too, with matters =
308 mathematical, I understand equations, both the simple and quadratical, Abo=
309 ut binomial theorem I'm teeming with a lot o' news, With many cheerful fac=
310 ts about the square of the hypotenuse. I'm very good at integral and diffe=
311 rential calculus; I know the scientific names of beings animalculous: In s=
312 hort, in matters vegetable, animal, and mineral, I am the very model of a =
313 modern Major-General. I know our mythic history, King Arthur's and Sir Car=
314 adoc's; I answer hard acrostics, I've a pretty taste for paradox, I quote =
315 in elegiacs all the crimes of Heliogabalus, In conics I can floor peculiar=
316 ities parabolous; I can tell undoubted Raphaels from Gerard Dows and Zoffa=
317 nies, I know the croaking chorus from The Frogs of Aristophanes! Then I c=
318 an hum a fugue of which I've heard the music's din afore, And whistle all =
319 the airs from that infernal nonsense Pinafore. =
322 This is a sec=C3=B6nd line.
325 run_prog mhbuild
"$draft"
326 check
"$draft" "$expected"
329 To: Mr Test <mrtest@example.com>
334 This is a test of a messege with a long line. This line needs to be longer than 998 to test out the encoding rules. Will that work? That's a good question; I don't know if it will or not. I am the very model of a modern Major-General, I've information vegetable, animal, and mineral, I know the kings of England, and I quote the fights historical From Marathon to Waterloo, in order categorical, I'm very well acquainted, too, with matters mathematical, I understand equations, both the simple and quadratical, About binomial theorem I'm teeming with a lot o' news, With many cheerful facts about the square of the hypotenuse. I'm very good at integral and differential calculus; I know the scientific names of beings animalculous: In short, in matters vegetable, animal, and mineral, I am the very model of a modern Major-General. I know our mythic history, King Arthur's and Sir Caradoc's; I answer hard acrostics, I've a pretty taste for paradox, I quote in elegiacs all the crimes of Heliogabalus, In conics I can floor peculiarities parabolous; I can tell undoubted Raphaels from Gerard Dows and Zoffanies, I know the croaking chorus from The Frogs of Aristophanes! Then I can hum a fugue of which I've heard the music's din afore, And whistle all the airs from that infernal nonsense Pinafore.
336 This is a secönd line.
340 run_test
'eval mhbuild "$draft" 2>&1' 'mhbuild: Line in content exceeds maximum line limit (998)'
344 # Check to make sure -maxunencoded does what we want.
348 To: Mr Test <mrtest@example.com>
352 This is the test of a lønger line than the usual limit. Assuming we set the maxunencded parameter properly, this should end up as 8bit?
355 cat > "$expected" <<EOF
356 To: Mr Test <mrtest@example.com>
360 Content-Type: text/plain; charset="UTF-8"
361 Content-Transfer-Encoding: 8bit
363 This is the test of a lønger line than the usual limit. Assuming we set the maxunencded parameter properly, this should end up as 8bit?
366 run_prog mhbuild
-maxunencoded 200 "$draft"
367 check
"$draft" "$expected"
369 [ ${failed:=0} -eq 0 ] && rm -f ${backup}