Add test case for MessageHeader decodeWord

This commit is contained in:
kmribti 2016-01-17 09:27:28 +01:00
parent f94d20492a
commit 8c98e4303c

View File

@ -362,6 +362,23 @@ void MessageHeaderTest::testFieldLimit()
}
void MessageHeaderTest::testDecodeWord()
{
std::string coded("this is pure ASCII");
std::string decoded = MessageHeader::decodeWord(coded, "ISO-8859-1");
assert(decoded == coded);
coded = "(=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=)";
decoded = MessageHeader::decodeWord(coded, "ISO-8859-1");
assert(decoded == "(a b)");
coded = "Hello =?UTF-8?B?RnJhbmNpcw==?=, good bye";
decoded = MessageHeader::decodeWord(coded, "ISO-8859-1");
assert(decoded == "Hello Francis, good bye");
}
void MessageHeaderTest::setUp()
{
}
@ -392,6 +409,7 @@ CppUnit::Test* MessageHeaderTest::suite()
CppUnit_addTest(pSuite, MessageHeaderTest, testSplitElements);
CppUnit_addTest(pSuite, MessageHeaderTest, testSplitParameters);
CppUnit_addTest(pSuite, MessageHeaderTest, testFieldLimit);
CppUnit_addTest(pSuite, MessageHeaderTest, testDecodeWord);
return pSuite;
}