diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/parser/mailboxGroupTest.cpp | 28 | ||||
-rw-r--r-- | tests/parser/mailboxListTest.cpp | 15 |
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/parser/mailboxGroupTest.cpp b/tests/parser/mailboxGroupTest.cpp index 18ff425b..00a7baad 100644 --- a/tests/parser/mailboxGroupTest.cpp +++ b/tests/parser/mailboxGroupTest.cpp @@ -32,6 +32,8 @@ VMIME_TEST_SUITE_BEGIN(mailboxGroupTest) VMIME_TEST(testParseExtraChars) VMIME_TEST(testEmptyGroup) VMIME_TEST(testEncodedEmptyGroup) + VMIME_TEST(testGroupInGroup) + VMIME_TEST(testBrokenGroup) VMIME_TEST_LIST_END @@ -104,4 +106,30 @@ VMIME_TEST_SUITE_BEGIN(mailboxGroupTest) VASSERT_EQ("count", 0, mgrp.getMailboxCount()); } + void testGroupInGroup() { + + vmime::mailboxGroup mgrp; + + VASSERT_EQ("name", "group1", mgrp.getName().getWholeBuffer()); + VASSERT_EQ("count", 2, mgrp.getMailboxCount()); + VASSERT_EQ("mbox1", "[email protected]", mgrp.getMailboxAt(0)->getEmail()); + VASSERT_EQ("mbox2", "[email protected]", mgrp.getMailboxAt(1)->getEmail()); + } + + void testBrokenGroup() { + + std::string bad(":,"); + + for (int i = 0 ; i < 10 ; ++i) { + bad = bad + bad; + } + + vmime::mailboxGroup mgrp; + mgrp.parse(bad); + + VASSERT_EQ("name", "", mgrp.getName().getWholeBuffer()); + VASSERT_EQ("count", 0, mgrp.getMailboxCount()); + } + VMIME_TEST_SUITE_END diff --git a/tests/parser/mailboxListTest.cpp b/tests/parser/mailboxListTest.cpp index 7505acd9..2036863d 100644 --- a/tests/parser/mailboxListTest.cpp +++ b/tests/parser/mailboxListTest.cpp @@ -28,6 +28,7 @@ VMIME_TEST_SUITE_BEGIN(mailboxListTest) VMIME_TEST_LIST_BEGIN VMIME_TEST(testParseGroup) + VMIME_TEST(testBrokenGroup) VMIME_TEST_LIST_END @@ -44,4 +45,18 @@ VMIME_TEST_SUITE_BEGIN(mailboxListTest) VASSERT_EQ("email", "[email protected]", mboxList.getMailboxAt(2)->getEmail().generate()); } + void testBrokenGroup() { + + std::string bad(":,"); + + for (int i = 0 ; i < 10 ; ++i) { + bad = bad + bad; + } + + vmime::mailboxList mboxList; + mboxList.parse(bad); + + VASSERT_EQ("count", 0, mboxList.getMailboxCount()); + } + VMIME_TEST_SUITE_END |