From 6f03b1e380e002b6d6041e19514ef9d4c7181df6 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Thu, 5 Apr 2012 22:10:54 +0200 Subject: [PATCH] Added test: Ensure '7bit' encoding is used when body is 7-bit only. --- tests/parser/bodyPartTest.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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