diff --git a/tests/parser/bodyPartTest.cpp b/tests/parser/bodyPartTest.cpp index 075b8f9a..e1d47a36 100644 --- a/tests/parser/bodyPartTest.cpp +++ b/tests/parser/bodyPartTest.cpp @@ -37,6 +37,7 @@ VMIME_TEST_SUITE_BEGIN VMIME_TEST(testPrologEpilog) VMIME_TEST(testPrologEncoding) VMIME_TEST(testSuccessiveBoundaries) + VMIME_TEST(testGenerate7bit) VMIME_TEST_LIST_END @@ -200,5 +201,18 @@ VMIME_TEST_SUITE_BEGIN VASSERT_EQ("part2-body", "", extractContents(p.getBody()->getPartAt(1)->getBody()->getContents())); } + /** Ensure '7bit' encoding is used when body is 7-bit only. */ + void testGenerate7bit() + { + vmime::ref p1 = vmime::create (); + p1->setText(vmime::create ("Part1 is US-ASCII only.")); + + vmime::ref msg = vmime::create (); + p1->generateIn(msg, msg); + + vmime::ref header1 = msg->getBody()->getPartAt(0)->getHeader(); + VASSERT_EQ("1", "7bit", header1->ContentTransferEncoding()->getValue()->generate()); + } + VMIME_TEST_SUITE_END