[PATCH v2 7/7] lib-mail: Update tests for message address
Pali Rohár
pali.rohar at gmail.com
Sun Jun 5 13:48:20 UTC 2016
---
src/lib-mail/test-message-address.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/lib-mail/test-message-address.c b/src/lib-mail/test-message-address.c
index 9bbf29e..bf85806 100644
--- a/src/lib-mail/test-message-address.c
+++ b/src/lib-mail/test-message-address.c
@@ -20,11 +20,13 @@ static void test_message_address(void)
static const char *input[] = {
"user at domain", NULL,
"<user at domain>", "user at domain",
- "foo bar <user at domain>", NULL,
- "\"foo bar\" <user at domain>", "foo bar <user at domain>",
+ "foo bar <user at domain>", "\"foo bar\" <user at domain>",
+ "\"foo bar\" <user at domain>", NULL,
+ "\"foo: <a at b>;,\" <user at domain>", NULL,
"<@route:user at domain>", NULL,
"<@route at route2:user at domain>", "<@route, at route2:user at domain>",
"hello <@route , at route2:user at domain>", "hello <@route, at route2:user at domain>",
+ "hello", NULL,
"user (hello)", NULL,
"hello <user>", NULL,
"@domain", NULL
@@ -40,9 +42,11 @@ static void test_message_address(void)
{ NULL, NULL, NULL, "user", "domain", FALSE },
{ NULL, "foo bar", NULL, "user", "domain", FALSE },
{ NULL, "foo bar", NULL, "user", "domain", FALSE },
+ { NULL, "foo: <a at b>;,", NULL, "user", "domain", FALSE },
{ NULL, NULL, "@route", "user", "domain", FALSE },
{ NULL, NULL, "@route, at route2", "user", "domain", FALSE },
{ NULL, "hello", "@route, at route2", "user", "domain", FALSE },
+ { NULL, "hello", NULL, "", "", TRUE },
{ NULL, "hello", NULL, "user", "", TRUE },
{ NULL, "hello", NULL, "user", "", TRUE },
{ NULL, NULL, NULL, "", "domain", TRUE }
@@ -104,10 +108,13 @@ static void test_message_address(void)
str_append(group, "group:;");
addr = message_address_parse(pool_datastack_create(), str_data(group),
str_len(group), UINT_MAX, FALSE);
+ str_truncate(str, 0);
+ message_address_write(str, addr);
test_assert(addr != NULL && cmp_addr(addr, &group_prefix));
addr = addr->next;
test_assert(addr != NULL && addr->next == NULL &&
cmp_addr(addr, &group_suffix));
+ test_assert(strcmp(str_c(str), "group:;") == 0);
test_end();
}
--
1.7.9.5
More information about the dovecot
mailing list