diff options
author | Vincent Richard <[email protected]> | 2012-04-05 20:29:32 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2012-04-05 20:29:32 +0000 |
commit | ec715e6058ffb6b4820a2511b35db53ac7a2e858 (patch) | |
tree | 25f5bb371ca333c7acc0a1673197efc2facacc7c /tests/utility/encoderTest.cpp | |
parent | Added test: Ensure '7bit' encoding is used when body is 7-bit only. (diff) | |
download | vmime-ec715e6058ffb6b4820a2511b35db53ac7a2e858.tar.gz vmime-ec715e6058ffb6b4820a2511b35db53ac7a2e858.zip |
Added tests for Quoted-Printable encoding.
Diffstat (limited to '')
-rw-r--r-- | tests/utility/encoderTest.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/utility/encoderTest.cpp b/tests/utility/encoderTest.cpp index f2d42b66..b2d6bc8e 100644 --- a/tests/utility/encoderTest.cpp +++ b/tests/utility/encoderTest.cpp @@ -33,6 +33,8 @@ VMIME_TEST_SUITE_BEGIN VMIME_TEST_LIST_BEGIN VMIME_TEST(testBase64) VMIME_TEST(testQuotedPrintable) + VMIME_TEST(testQuotedPrintable_SoftLineBreaks) + VMIME_TEST(testQuotedPrintable_CRLF) VMIME_TEST(testQuotedPrintable_RFC2047) VMIME_TEST_LIST_END @@ -288,6 +290,35 @@ VMIME_TEST_SUITE_BEGIN } } + /** Tests Soft Line Breaks (RFC-2047/6.7(5). */ + void testQuotedPrintable_SoftLineBreaks() + { + VASSERT_EQ("1", "Now's the time=\r\n" + " for all folk =\r\n" + "to come to the=\r\n" + " aid of their =\r\n" + "country.", + encode("quoted-printable", "Now's the time for all folk " + "to come to the aid of their country.", 15)); + } + + /** In text mode, ensure line breaks in QP-encoded text are represented + * by a CRLF sequence, as per RFC-2047/6.7(4). */ + void testQuotedPrintable_CRLF() + { + vmime::propertySet encProps; + + // in "text" mode + encProps["text"] = true; + VASSERT_EQ("text", "line1\r\nline2", + encode("quoted-printable", "line1\r\nline2", 80, encProps)); + + // in "binary" mode + encProps["text"] = false; + VASSERT_EQ("binary", "line1=0D=0Aline2", + encode("quoted-printable", "line1\r\nline2", 80, encProps)); + } + void testQuotedPrintable_RFC2047() { /* |