diff options
author | Jan Engelhardt <[email protected]> | 2019-01-24 12:14:50 +0000 |
---|---|---|
committer | Jan Engelhardt <[email protected]> | 2019-01-24 12:17:52 +0000 |
commit | cc18aa39c15ffffdd622cb61c3c147c2bc1903aa (patch) | |
tree | 4f50f046739a54d1f65990ce3a63ad6163e7f6da | |
parent | #206 Initialize and delete pointers (diff) | |
download | vmime-cc18aa39c15ffffdd622cb61c3c147c2bc1903aa.tar.gz vmime-cc18aa39c15ffffdd622cb61c3c147c2bc1903aa.zip |
tests: add more malformation tests to mailboxTest
-rw-r--r-- | tests/parser/mailboxTest.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/tests/parser/mailboxTest.cpp b/tests/parser/mailboxTest.cpp index 127bb422..a0d1b694 100644 --- a/tests/parser/mailboxTest.cpp +++ b/tests/parser/mailboxTest.cpp @@ -30,7 +30,7 @@ VMIME_TEST_SUITE_BEGIN(mailboxTest) VMIME_TEST(testParse) VMIME_TEST(testEmptyEmailAddress) VMIME_TEST(testSeparatorInComment) - VMIME_TEST(testAddressInName) + VMIME_TEST(testMalformations) VMIME_TEST_LIST_END @@ -146,13 +146,28 @@ VMIME_TEST_SUITE_BEGIN(mailboxTest) VASSERT_EQ("email2", "[email protected]", mbox2->getEmail()); } - void testAddressInName() { - + void testMalformations() { vmime::mailbox mbox; - mbox.parse("[email protected] <[email protected]>"); + mbox.parse("[email protected] <[email protected]>"); VASSERT_EQ("name", vmime::text("[email protected]"), mbox.getName()); VASSERT_EQ("email", "[email protected]", mbox.getEmail()); + + VASSERT_EQ("name", vmime::text("[email protected]"), mbox.getName()); + VASSERT_EQ("email", "[email protected]", mbox.getEmail()); + + mbox.parse("Foo <bar<[email protected]>"); + VASSERT_EQ("name", vmime::text("Foobar"), mbox.getName()); + VASSERT_EQ("email", "[email protected]", mbox.getEmail()); + + mbox.parse("Foo <[email protected]> <[email protected]>"); + VASSERT_EQ("name", vmime::text("Foo"), mbox.getName()); + VASSERT_EQ("email", "[email protected]", mbox.getEmail()); + + mbox.parse("Foo <[email protected]> Bar <[email protected]>"); + VASSERT_EQ("name", vmime::text("Foo"), mbox.getName()); + VASSERT_EQ("email", "[email protected]", mbox.getEmail()); } VMIME_TEST_SUITE_END |