aboutsummaryrefslogtreecommitdiffstats
path: root/tests/parser/mailboxTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/parser/mailboxTest.cpp')
-rw-r--r--tests/parser/mailboxTest.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/tests/parser/mailboxTest.cpp b/tests/parser/mailboxTest.cpp
index 6bf6670c..127bb422 100644
--- a/tests/parser/mailboxTest.cpp
+++ b/tests/parser/mailboxTest.cpp
@@ -1,6 +1,6 @@
//
// VMime library (http://www.vmime.org)
-// Copyright (C) 2002-2013 Vincent Richard <[email protected]>
+// Copyright (C) 2002 Vincent Richard <[email protected]>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
@@ -30,13 +30,14 @@ VMIME_TEST_SUITE_BEGIN(mailboxTest)
VMIME_TEST(testParse)
VMIME_TEST(testEmptyEmailAddress)
VMIME_TEST(testSeparatorInComment)
+ VMIME_TEST(testAddressInName)
VMIME_TEST_LIST_END
- void testParse()
- {
- static const vmime::string testSuitesParse[] =
- {
+ void testParse() {
+
+ static const vmime::string testSuitesParse[] = {
+
// Test 1
"My (this is a comment)name <me(another \\)comment) @ somewhere(else).com>",
@@ -93,8 +94,8 @@ VMIME_TEST_SUITE_BEGIN(mailboxTest)
"[address-list: [[mailbox: name=[text: [[word: charset=us-ascii, buffer=John]]], [email protected]]]]"
};
- for (unsigned int i = 0 ; i < sizeof(testSuitesParse) / sizeof(testSuitesParse[0]) / 2 ; ++i)
- {
+ for (unsigned int i = 0 ; i < sizeof(testSuitesParse) / sizeof(testSuitesParse[0]) / 2 ; ++i) {
+
vmime::string in = testSuitesParse[i * 2];
vmime::string out = testSuitesParse[i * 2 + 1];
@@ -111,8 +112,8 @@ VMIME_TEST_SUITE_BEGIN(mailboxTest)
}
}
- void testEmptyEmailAddress()
- {
+ void testEmptyEmailAddress() {
+
vmime::addressList addrList;
addrList.parse("\"Full Name\" <>");
@@ -126,8 +127,8 @@ VMIME_TEST_SUITE_BEGIN(mailboxTest)
VASSERT_EQ("email", "", mbox->getEmail());
}
- void testSeparatorInComment()
- {
+ void testSeparatorInComment() {
+
vmime::addressList addrList;
addrList.parse("aaa(comment,comment)@vmime.org, [email protected]");
@@ -145,5 +146,13 @@ VMIME_TEST_SUITE_BEGIN(mailboxTest)
VASSERT_EQ("email2", "[email protected]", mbox2->getEmail());
}
-VMIME_TEST_SUITE_END
+ void testAddressInName() {
+
+ vmime::mailbox mbox;
+ VASSERT_EQ("name", vmime::text("[email protected]"), mbox.getName());
+ VASSERT_EQ("email", "[email protected]", mbox.getEmail());
+ }
+
+VMIME_TEST_SUITE_END