aboutsummaryrefslogtreecommitdiffstats
path: root/tests/utility/encoder/qpEncoderTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utility/encoder/qpEncoderTest.cpp')
-rw-r--r--tests/utility/encoder/qpEncoderTest.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/utility/encoder/qpEncoderTest.cpp b/tests/utility/encoder/qpEncoderTest.cpp
index 50183488..e7d1bcd2 100644
--- a/tests/utility/encoder/qpEncoderTest.cpp
+++ b/tests/utility/encoder/qpEncoderTest.cpp
@@ -31,6 +31,8 @@ VMIME_TEST_SUITE_BEGIN(qpEncoderTest)
VMIME_TEST_LIST_BEGIN
VMIME_TEST(testQuotedPrintable)
VMIME_TEST(testQuotedPrintable_SoftLineBreaks)
+ VMIME_TEST(testQuotedPrintable_HardLineBreakEncode)
+ VMIME_TEST(testQuotedPrintable_HardLineBreakDecode)
VMIME_TEST(testQuotedPrintable_CRLF)
VMIME_TEST(testQuotedPrintable_RFC2047)
VMIME_TEST_LIST_END
@@ -157,6 +159,42 @@ VMIME_TEST_SUITE_BEGIN(qpEncoderTest)
"to come to the aid of their country.", 15));
}
+ void testQuotedPrintable_HardLineBreakEncode()
+ {
+ const std::string data =
+ "If you believe that truth=beauty,"
+ " then surely mathematics\r\nis the most"
+ " beautiful branch of philosophy.";
+
+ const std::string expected =
+ "If you believe that truth=3Dbeauty=\r\n"
+ ", then surely mathematics\r\n"
+ "is the most beautiful branch of ph=\r\n"
+ "ilosophy.";
+
+ vmime::propertySet encProps;
+ encProps["text"] = true;
+
+ VASSERT_EQ("1", expected, encode("quoted-printable", data, 35, encProps));
+ }
+
+ void testQuotedPrintable_HardLineBreakDecode()
+ {
+ const std::string expected =
+ "If you believe that truth=beauty,"
+ " then surely mathematics\r\nis the most"
+ " beautiful branch of philosophy.";
+
+ const std::string data =
+ "If you believe that truth=3Dbeauty=\r\n"
+ ", then surely mathematics\r\n"
+ "is the most beautiful branch of ph=\r\n"
+ "ilosophy.";
+
+ VASSERT_EQ("1", expected, decode("quoted-printable", data, 35));
+ }
+
+
/** 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()