diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/parser/bodyTest.cpp | 1 | ||||
-rw-r--r-- | tests/parser/mailboxTest.cpp | 14 |
2 files changed, 14 insertions, 1 deletions
diff --git a/tests/parser/bodyTest.cpp b/tests/parser/bodyTest.cpp index fa396af5..31054f30 100644 --- a/tests/parser/bodyTest.cpp +++ b/tests/parser/bodyTest.cpp @@ -31,7 +31,6 @@ VMIME_TEST_SUITE_BEGIN(bodyTest) VMIME_TEST(testGenerate_NonText) VMIME_TEST_LIST_END - void testGenerate_Text() { // RFC-2015: [Quoted-Printable encoding] A line break in a text body, diff --git a/tests/parser/mailboxTest.cpp b/tests/parser/mailboxTest.cpp index 23d1b4ac..997a6a38 100644 --- a/tests/parser/mailboxTest.cpp +++ b/tests/parser/mailboxTest.cpp @@ -31,6 +31,7 @@ VMIME_TEST_SUITE_BEGIN(mailboxTest) VMIME_TEST(testEmptyEmailAddress) VMIME_TEST(testSeparatorInComment) VMIME_TEST(testMalformations) + VMIME_TEST(testExcessiveQuoting) VMIME_TEST_LIST_END @@ -170,4 +171,17 @@ VMIME_TEST_SUITE_BEGIN(mailboxTest) VASSERT_EQ("email", "[email protected]", mbox.getEmail()); } + void testExcessiveQuoting() { + using namespace vmime; + + // Check that ASCII display names are not encoded more than necessary + emailAddress e("[email protected]"); + auto a = make_shared<mailbox>(text(word("Foo B@r", charsets::US_ASCII)), e); + VASSERT_EQ("generate", "\"Foo B@r\" <[email protected]>", a->generate()); + VASSERT_NEQ("generate", "=?utf-8?Q?Foo_B=40r?= <[email protected]>", a->generate()); + + a = make_shared<mailbox>(text(word("Foo B@r", charsets::UTF_8)), e); + VASSERT_EQ("generate", "=?utf-8?Q?Foo_B=40r?= <[email protected]>", a->generate()); + } + VMIME_TEST_SUITE_END |