From 32a80f6c1ed501ceb2e1d7613dcdcce6cdf6fe23 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Mon, 11 Mar 2013 10:05:09 +0100 Subject: Fixed mailbox and mailbox group parsing. Added unit tests. --- tests/parser/mailboxTest.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/parser/mailboxTest.cpp') diff --git a/tests/parser/mailboxTest.cpp b/tests/parser/mailboxTest.cpp index a6e46577..e6e4a608 100644 --- a/tests/parser/mailboxTest.cpp +++ b/tests/parser/mailboxTest.cpp @@ -29,6 +29,7 @@ VMIME_TEST_SUITE_BEGIN(mailboxTest) VMIME_TEST_LIST_BEGIN VMIME_TEST(testParse) VMIME_TEST(testEmptyEmailAddress) + VMIME_TEST(testSeparatorInComment) VMIME_TEST_LIST_END @@ -124,5 +125,22 @@ VMIME_TEST_SUITE_BEGIN(mailboxTest) VASSERT_EQ("email", "", mbox->getEmail()); } + void testSeparatorInComment() + { + vmime::addressList addrList; + addrList.parse("aaa(comment,comment)@vmime.org, bbb@vmime.org"); + + VASSERT_EQ("count", 2, addrList.getAddressCount()); + + vmime::ref mbox1 = addrList.getAddressAt(0).dynamicCast (); + vmime::ref mbox2 = addrList.getAddressAt(1).dynamicCast (); + + VASSERT_EQ("name1", vmime::text(), mbox1->getName()); + VASSERT_EQ("email1", "aaa@vmime.org", mbox1->getEmail()); + + VASSERT_EQ("name2", vmime::text(), mbox2->getName()); + VASSERT_EQ("email2", "bbb@vmime.org", mbox2->getEmail()); + } + VMIME_TEST_SUITE_END -- cgit v1.2.3