]> granicus.if.org Git - neomutt/commitdiff
Add tests for mutt_addrlist_qualify
authorPietro Cerutti <gahr@gahr.ch>
Mon, 20 May 2019 11:44:41 +0000 (11:44 +0000)
committerRichard Russon <rich@flatcap.org>
Thu, 23 May 2019 10:57:10 +0000 (11:57 +0100)
test/address/mutt_addrlist_qualify.c

index 91be5c2109e8e65f1c17ee1325a59a21dbcedc22..93db880392a95b82fd2421468253a38f55bf706b 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "mutt/mutt.h"
 #include "address/lib.h"
+#include "common.h"
 
 void test_mutt_addrlist_qualify(void)
 {
@@ -41,4 +42,21 @@ void test_mutt_addrlist_qualify(void)
     mutt_addrlist_qualify(&al, NULL);
     TEST_CHECK_(1, "mutt_addrlist_qualify(&addr, NULL)");
   }
+
+  {
+    struct AddressList al = TAILQ_HEAD_INITIALIZER(al);
+    mutt_addrlist_parse(&al, "john@doe.org, user1, user2, test@example.com");
+    mutt_addrlist_qualify(&al, "local.domain");
+    struct Address *a = TAILQ_FIRST(&al);
+    TEST_CHECK_STR_EQ("john@doe.org", a->mailbox);
+    a = TAILQ_NEXT(a, entries);
+    TEST_CHECK_STR_EQ("user1@local.domain", a->mailbox);
+    a = TAILQ_NEXT(a, entries);
+    TEST_CHECK_STR_EQ("user2@local.domain", a->mailbox);
+    a = TAILQ_NEXT(a, entries);
+    TEST_CHECK_STR_EQ("test@example.com", a->mailbox);
+    a = TAILQ_NEXT(a, entries);
+    TEST_CHECK(a == NULL);
+    mutt_addrlist_clear(&al);
+  }
 }