aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2014-06-01 18:46:17 +0000
committerVincent Richard <[email protected]>2014-06-01 18:46:17 +0000
commit30ea54f269efa673a1eb5bc07e71715b67607dbc (patch)
tree456f9152fa4a341891c083313af952ae5a1250bc /tests
parentFixed segfault in POP3 test. (diff)
downloadvmime-30ea54f269efa673a1eb5bc07e71715b67607dbc.tar.gz
vmime-30ea54f269efa673a1eb5bc07e71715b67607dbc.zip
Fixed parsing of empty lines in header field value.
Diffstat (limited to 'tests')
-rw-r--r--tests/parser/headerFieldTest.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/parser/headerFieldTest.cpp b/tests/parser/headerFieldTest.cpp
index 5281a3a2..0642dae7 100644
--- a/tests/parser/headerFieldTest.cpp
+++ b/tests/parser/headerFieldTest.cpp
@@ -30,6 +30,7 @@ VMIME_TEST_SUITE_BEGIN(headerFieldTest)
VMIME_TEST(testBadValueType)
VMIME_TEST(testValueOnNextLine)
VMIME_TEST(testStripSpacesAtEnd)
+ VMIME_TEST(testValueWithEmptyLine)
VMIME_TEST_LIST_END
@@ -84,4 +85,20 @@ VMIME_TEST_SUITE_BEGIN(headerFieldTest)
VASSERT_EQ("Field value", toHex("field data"), toHex(hvalue->getWholeBuffer()));
}
+ void testValueWithEmptyLine()
+ {
+ vmime::parsingContext ctx;
+
+ const vmime::string buffer = "Field: \r\n\tdata1\r\n\tdata2\r\n\t\r\n\tdata3";
+
+ vmime::shared_ptr <vmime::headerField> hfield =
+ vmime::headerField::parseNext(ctx, buffer, 0, buffer.size());
+
+ vmime::shared_ptr <vmime::text> hvalue =
+ hfield->getValue <vmime::text>();
+
+ VASSERT_EQ("Field name", "Field", hfield->getName());
+ VASSERT_EQ("Field value", "data1 data2 data3", hvalue->getWholeBuffer());
+ }
+
VMIME_TEST_SUITE_END