diff options
author | Vincent Richard <[email protected]> | 2012-04-05 21:15:04 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2012-04-05 21:15:04 +0000 |
commit | 0633a49b049de934f11fee89c2cd448f4694f20e (patch) | |
tree | 482c0bc990a4b2f98ef81256bac331499ba6379d /tests | |
parent | Added tests for Quoted-Printable encoding. (diff) | |
download | vmime-0633a49b049de934f11fee89c2cd448f4694f20e.tar.gz vmime-0633a49b049de934f11fee89c2cd448f4694f20e.zip |
Fixed wrong encoding of line breaks in QP-encoded text (issue #7).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/parser/bodyPartTest.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/parser/bodyPartTest.cpp b/tests/parser/bodyPartTest.cpp index e1d47a36..9d51262a 100644 --- a/tests/parser/bodyPartTest.cpp +++ b/tests/parser/bodyPartTest.cpp @@ -38,6 +38,7 @@ VMIME_TEST_SUITE_BEGIN VMIME_TEST(testPrologEncoding) VMIME_TEST(testSuccessiveBoundaries) VMIME_TEST(testGenerate7bit) + VMIME_TEST(testTextUsageForQPEncoding) VMIME_TEST_LIST_END @@ -214,5 +215,28 @@ VMIME_TEST_SUITE_BEGIN VASSERT_EQ("1", "7bit", header1->ContentTransferEncoding()->getValue()->generate()); } + void testTextUsageForQPEncoding() + { + vmime::ref <vmime::plainTextPart> part = vmime::create <vmime::plainTextPart>(); + part->setText(vmime::create <vmime::stringContentHandler>("Part1-line1\r\nPart1-line2\r\n\x89")); + + vmime::ref <vmime::message> msg = vmime::create <vmime::message>(); + part->generateIn(msg, msg); + + vmime::ref <vmime::body> body = msg->getBody()->getPartAt(0)->getBody(); + vmime::ref <vmime::header> header = msg->getBody()->getPartAt(0)->getHeader(); + + std::ostringstream oss; + vmime::utility::outputStreamAdapter os(oss); + body->generate(os, 80); + + VASSERT_EQ("1", "quoted-printable", header->ContentTransferEncoding()->getValue()->generate()); + + // This should *NOT* be: + // Part1-line1=0D=0APart1-line2=0D=0A=89 + VASSERT_EQ("2", "Part1-line1\r\nPart1-line2\r\n=89", oss.str()); + } + + VMIME_TEST_SUITE_END |