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 LC_ALL=en_US.UTF-8; export LC_ALL
21 draft="$MH_TEST_DIR/$$.draft"
22 expected="$MH_TEST_DIR/$$.expected"
25 # Force some text to be quoted-printable
29 To: Mr Test <mrtest@example.com>
34 This is a test of a message with a shørt line.
37 run_prog mhbuild "$draft"
39 cat > "$expected" <<EOF
40 To: Mr Test <mrtest@example.com>
44 Content-Type: text/plain; charset="UTF-8"
45 Content-Transfer-Encoding: quoted-printable
47 This is a test of a message with a sh=C3=B8rt line.
51 # Force some text to be base64, to test out the encoder. Try at different
52 # line lengths to check out the padding on the routines to convert LF to
53 # CR LF. The current implementation reads in using a 3 byte buffer, so make
54 # sure we catch all of those cases.
58 To: Mr Test <mrtest@example.com>
63 This is a test of a message with a shørt line.
66 run_prog mhbuild "$draft"
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 check "$draft" "$expected"
82 To: Mr Test <mrtest@example.com>
87 This is a test of a mëssage with a shørt line.
90 run_prog mhbuild "$draft"
92 cat > "$expected" <<EOF
93 To: Mr Test <mrtest@example.com>
97 Content-Type: text/plain; charset="UTF-8"
98 Content-Transfer-Encoding: base64
100 VGhpcyBpcyBhIHRlc3Qgb2YgYSBtw6tzc2FnZSB3aXRoIGEgc2jDuHJ0IGxpbmUuDQo=
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 run_prog mhbuild "$draft"
116 cat > "$expected" <<EOF
117 To: Mr Test <mrtest@example.com>
121 Content-Type: text/plain; charset="UTF-8"
122 Content-Transfer-Encoding: base64
124 VGhpcyBpcyBhIHRlc3Qgb2YgYSBtw6tzc8OkZ2Ugd2l0aCBhIHNow7hydCBsaW5lLg0K
127 check "$draft" "$expected"
130 To: Mr Test <mrtest@example.com>
135 This is a test of a message with a shørt line.
136 This is a second line.
139 run_prog mhbuild "$draft"
141 cat > "$expected" <<EOF
142 To: Mr Test <mrtest@example.com>
146 Content-Type: text/plain; charset="UTF-8"
147 Content-Transfer-Encoding: base64
149 VGhpcyBpcyBhIHRlc3Qgb2YgYSBtZXNzYWdlIHdpdGggYSBzaMO4cnQgbGluZS4NClRoaXMgaXMg
150 YSBzZWNvbmQgbGluZS4NCg==
153 check "$draft" "$expected"
156 To: Mr Test <mrtest@example.com>
161 This is a test of a mëssage with a shørt line.
162 This is a second line.
165 run_prog mhbuild "$draft"
167 cat > "$expected" <<EOF
168 To: Mr Test <mrtest@example.com>
172 Content-Type: text/plain; charset="UTF-8"
173 Content-Transfer-Encoding: base64
175 VGhpcyBpcyBhIHRlc3Qgb2YgYSBtw6tzc2FnZSB3aXRoIGEgc2jDuHJ0IGxpbmUuDQpUaGlzIGlz
176 IGEgc2Vjb25kIGxpbmUuDQo=
179 check "$draft" "$expected"
182 To: Mr Test <mrtest@example.com>
187 This is a test of a mëssäge with a shørt line.
188 This is a second line.
191 run_prog mhbuild "$draft"
193 cat > "$expected" <<EOF
194 To: Mr Test <mrtest@example.com>
198 Content-Type: text/plain; charset="UTF-8"
199 Content-Transfer-Encoding: base64
201 VGhpcyBpcyBhIHRlc3Qgb2YgYSBtw6tzc8OkZ2Ugd2l0aCBhIHNow7hydCBsaW5lLg0KVGhpcyBp
202 cyBhIHNlY29uZCBsaW5lLg0K
205 check "$draft" "$expected"
208 To: Mr Test <mrtest@example.com>
213 This is a test of a mëssäge with a shørt line.
216 This is a second line.
223 run_prog mhbuild "$draft"
225 cat > "$expected" <<EOF
226 To: Mr Test <mrtest@example.com>
230 Content-Type: text/plain; charset="UTF-8"
231 Content-Transfer-Encoding: base64
233 VGhpcyBpcyBhIHRlc3Qgb2YgYSBtw6tzc8OkZ2Ugd2l0aCBhIHNow7hydCBsaW5lLg0KDQoNClRo
234 aXMgaXMgYSBzZWNvbmQgbGluZS4NCg0KDQoNCg0K
237 check "$draft" "$expected"
240 # Test out some "long" text. By default it should end up as quoted-printable.
241 # But if we request 8bit we should error out if the line is greater than
246 To: Mr Test <mrtest@example.com>
250 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.
252 This is a second line.
255 run_prog mhbuild "$draft"
257 cat > "$expected" <<EOF
258 To: Mr Test <mrtest@example.com>
262 Content-Type: text/plain; charset="us-ascii"
263 Content-Transfer-Encoding: quoted-printable
265 This is a test of a messege with a long line. This line needs to be longe=
266 r than 998 to test out the encoding rules. Will that work? That's a good=
267 question; I don't know if it will or not. I am the very model of a moder=
268 n Major-General, I've information vegetable, animal, and mineral, I know t=
269 he kings of England, and I quote the fights historical From Marathon to Wa=
270 terloo, in order categorical, I'm very well acquainted, too, with matters =
271 mathematical, I understand equations, both the simple and quadratical, Abo=
272 ut binomial theorem I'm teeming with a lot o' news, With many cheerful fac=
273 ts about the square of the hypotenuse. I'm very good at integral and diffe=
274 rential calculus; I know the scientific names of beings animalculous: In s=
275 hort, in matters vegetable, animal, and mineral, I am the very model of a =
276 modern Major-General. I know our mythic history, King Arthur's and Sir Car=
277 adoc's; I answer hard acrostics, I've a pretty taste for paradox, I quote =
278 in elegiacs all the crimes of Heliogabalus, In conics I can floor peculiar=
279 ities parabolous; I can tell undoubted Raphaels from Gerard Dows and Zoffa=
280 nies, I know the croaking chorus from The Frogs of Aristophanes! Then I c=
281 an hum a fugue of which I've heard the music's din afore, And whistle all =
282 the airs from that infernal nonsense Pinafore. =
285 This is a second line.
288 check "$draft" "$expected"
291 To: Mr Test <mrtest@example.com>
295 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.
297 This is a secönd line.
300 run_prog mhbuild "$draft"
302 cat > "$expected" <<EOF
303 To: Mr Test <mrtest@example.com>
307 Content-Type: text/plain; charset="UTF-8"
308 Content-Transfer-Encoding: quoted-printable
310 This is a test of a messege with a long line. This line needs to be longe=
311 r than 998 to test out the encoding rules. Will that work? That's a good=
312 question; I don't know if it will or not. I am the very model of a moder=
313 n Major-General, I've information vegetable, animal, and mineral, I know t=
314 he kings of England, and I quote the fights historical From Marathon to Wa=
315 terloo, in order categorical, I'm very well acquainted, too, with matters =
316 mathematical, I understand equations, both the simple and quadratical, Abo=
317 ut binomial theorem I'm teeming with a lot o' news, With many cheerful fac=
318 ts about the square of the hypotenuse. I'm very good at integral and diffe=
319 rential calculus; I know the scientific names of beings animalculous: In s=
320 hort, in matters vegetable, animal, and mineral, I am the very model of a =
321 modern Major-General. I know our mythic history, King Arthur's and Sir Car=
322 adoc's; I answer hard acrostics, I've a pretty taste for paradox, I quote =
323 in elegiacs all the crimes of Heliogabalus, In conics I can floor peculiar=
324 ities parabolous; I can tell undoubted Raphaels from Gerard Dows and Zoffa=
325 nies, I know the croaking chorus from The Frogs of Aristophanes! Then I c=
326 an hum a fugue of which I've heard the music's din afore, And whistle all =
327 the airs from that infernal nonsense Pinafore. =
330 This is a sec=C3=B6nd line.
333 check "$draft" "$expected"
336 To: Mr Test <mrtest@example.com>
341 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.
343 This is a secönd line.
347 run_test 'eval mhbuild "$draft" 2>&1' 'mhbuild: Line in content exceeds maximum line limit (998)'
351 # Check to make sure -maxunencoded does what we want.
355 To: Mr Test <mrtest@example.com>
359 This is the test of a lønger line than the ususal limit. Assuming we set the maxunencded parameter properly, this should end up as 8bit?
362 run_prog mhbuild -maxunencoded 200 "$draft"
364 cat > "$expected" <<EOF
365 To: Mr Test <mrtest@example.com>
369 Content-Type: text/plain; charset="UTF-8"
370 Content-Transfer-Encoding: 8bit
372 This is the test of a lønger line than the ususal limit. Assuming we set the maxunencded parameter properly, this should end up as 8bit?
375 check "$draft" "$expected"