X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/628b193daced4357675de5127ff8129cf6f81b0f..fb6b8301237bcdd72bb86d34af68f378a07e4d70:/test/mhbuild/test-cte diff --git a/test/mhbuild/test-cte b/test/mhbuild/test-cte index 517fbc51..e4a8fbf5 100755 --- a/test/mhbuild/test-cte +++ b/test/mhbuild/test-cte @@ -14,9 +14,12 @@ fi setup_test -LC_ALL=en_US.UTF-8; export LC_ALL +set -e + +require_locale en_US.UTF-8 en_US.UTF8 en_US.utf-8 en_US.utf8 draft="$MH_TEST_DIR/$$.draft" +backup="${MH_TEST_DIR}/`mhparam sbackup`$$.draft.orig" expected="$MH_TEST_DIR/$$.expected" # @@ -47,7 +50,9 @@ EOF # # Force some text to be base64, to test out the encoder. Try at different -# line lengths to check out the padding on the +# line lengths to check out the padding on the routines to convert LF to +# CR LF. The current implementation reads in using a 3 byte buffer, so make +# sure we catch all of those cases. # cat > "$draft" < "$draft" < +cc: +Fcc: +outbox +------ +# "$expected" < +cc: +Fcc: +outbox +MIME-Version: 1.0 +Content-Type: text/plain; charset="UTF-8" +Content-Transfer-Encoding: base64 + +VGhpcyBpcyBhIHRlc3Qgb2YgYSBtw6tzc8OkZ2Ugd2l0aCBhIHNow7hydCBsaW5lLg0K +EOF + +check "$draft" "$expected" + +cat > "$draft" < +cc: +Fcc: +outbox +------ +# "$expected" < +cc: +Fcc: +outbox +MIME-Version: 1.0 +Content-Type: text/plain; charset="UTF-8" +Content-Transfer-Encoding: base64 + +VGhpcyBpcyBhIHRlc3Qgb2YgYSBtZXNzYWdlIHdpdGggYSBzaMO4cnQgbGluZS4NClRoaXMgaXMg +YSBzZWNvbmQgbGluZS4NCg== +EOF + +check "$draft" "$expected" + +cat > "$draft" < +cc: +Fcc: +outbox +------ +# "$expected" < +cc: +Fcc: +outbox +MIME-Version: 1.0 +Content-Type: text/plain; charset="UTF-8" +Content-Transfer-Encoding: base64 + +VGhpcyBpcyBhIHRlc3Qgb2YgYSBtw6tzc2FnZSB3aXRoIGEgc2jDuHJ0IGxpbmUuDQpUaGlzIGlz +IGEgc2Vjb25kIGxpbmUuDQo= +EOF + +check "$draft" "$expected" + +cat > "$draft" < +cc: +Fcc: +outbox +------ +# "$expected" < +cc: +Fcc: +outbox +MIME-Version: 1.0 +Content-Type: text/plain; charset="UTF-8" +Content-Transfer-Encoding: base64 + +VGhpcyBpcyBhIHRlc3Qgb2YgYSBtw6tzc8OkZ2Ugd2l0aCBhIHNow7hydCBsaW5lLg0KVGhpcyBp +cyBhIHNlY29uZCBsaW5lLg0K +EOF + +check "$draft" "$expected" + +cat > "$draft" < +cc: +Fcc: +outbox +------ +# "$expected" < +cc: +Fcc: +outbox +MIME-Version: 1.0 +Content-Type: text/plain; charset="UTF-8" +Content-Transfer-Encoding: base64 + +VGhpcyBpcyBhIHRlc3Qgb2YgYSBtw6tzc8OkZ2Ugd2l0aCBhIHNow7hydCBsaW5lLg0KDQoNClRo +aXMgaXMgYSBzZWNvbmQgbGluZS4NCg0KDQoNCg0K +EOF + +check "$draft" "$expected" + +# +# Test out some "long" text. By default it should end up as quoted-printable. +# But if we request 8bit we should error out if the line is greater than +# 998. +# + +cat > "$draft" < +cc: +Fcc: +outbox +------ +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. + +This is a second line. +EOF + +run_prog mhbuild "$draft" + +cat > "$expected" < +cc: +Fcc: +outbox +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +This is a test of a messege with a long line. This line needs to be longe= +r 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 moder= +n Major-General, I've information vegetable, animal, and mineral, I know t= +he kings of England, and I quote the fights historical From Marathon to Wa= +terloo, in order categorical, I'm very well acquainted, too, with matters = +mathematical, I understand equations, both the simple and quadratical, Abo= +ut binomial theorem I'm teeming with a lot o' news, With many cheerful fac= +ts about the square of the hypotenuse. I'm very good at integral and diffe= +rential calculus; I know the scientific names of beings animalculous: In s= +hort, 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 Car= +adoc'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 peculiar= +ities parabolous; I can tell undoubted Raphaels from Gerard Dows and Zoffa= +nies, I know the croaking chorus from The Frogs of Aristophanes! Then I c= +an hum a fugue of which I've heard the music's din afore, And whistle all = +the airs from that infernal nonsense Pinafore. = + + +This is a second line. +EOF + +check "$draft" "$expected" + +cat > "$draft" < +cc: +Fcc: +outbox +------ +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. + +This is a secönd line. +EOF + +run_prog mhbuild "$draft" + +cat > "$expected" < +cc: +Fcc: +outbox +MIME-Version: 1.0 +Content-Type: text/plain; charset="UTF-8" +Content-Transfer-Encoding: quoted-printable + +This is a test of a messege with a long line. This line needs to be longe= +r 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 moder= +n Major-General, I've information vegetable, animal, and mineral, I know t= +he kings of England, and I quote the fights historical From Marathon to Wa= +terloo, in order categorical, I'm very well acquainted, too, with matters = +mathematical, I understand equations, both the simple and quadratical, Abo= +ut binomial theorem I'm teeming with a lot o' news, With many cheerful fac= +ts about the square of the hypotenuse. I'm very good at integral and diffe= +rential calculus; I know the scientific names of beings animalculous: In s= +hort, 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 Car= +adoc'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 peculiar= +ities parabolous; I can tell undoubted Raphaels from Gerard Dows and Zoffa= +nies, I know the croaking chorus from The Frogs of Aristophanes! Then I c= +an hum a fugue of which I've heard the music's din afore, And whistle all = +the airs from that infernal nonsense Pinafore. = + + +This is a sec=C3=B6nd line. +EOF + +check "$draft" "$expected" + +cat > "$draft" < +cc: +Fcc: +outbox +------ +#&1' 'mhbuild: Line in content exceeds maximum line limit (998)' +set -e + +# +# Check to make sure -maxunencoded does what we want. +# + +cat > "$draft" < +cc: +Fcc: +outbox +------ +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? +EOF + +run_prog mhbuild -maxunencoded 200 "$draft" + +cat > "$expected" < +cc: +Fcc: +outbox +MIME-Version: 1.0 +Content-Type: text/plain; charset="UTF-8" +Content-Transfer-Encoding: 8bit + +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? +EOF + +check "$draft" "$expected" + +[ ${failed:=0} -eq 0 ] && rm -f ${backup} + exit ${failed:-0}