]> granicus.if.org Git - neomutt/commitdiff
Add tests for mutt_addrlist_free
authorPietro Cerutti <gahr@gahr.ch>
Sun, 19 May 2019 09:06:15 +0000 (09:06 +0000)
committerRichard Russon <rich@flatcap.org>
Thu, 23 May 2019 10:57:10 +0000 (11:57 +0100)
test/address/mutt_addrlist_free.c

index 84e12a888705d034f204fe2766bce016cbb204bc..2f20890843f482c812890d2594f594bbadf3521c 100644 (file)
@@ -25,6 +25,7 @@
 #include "config.h"
 #include "mutt/mutt.h"
 #include "address/lib.h"
+#include "common.h"
 
 void test_mutt_addrlist_free(void)
 {
@@ -34,4 +35,15 @@ void test_mutt_addrlist_free(void)
     mutt_addrlist_free(NULL);
     TEST_CHECK_(1, "mutt_addrlist_free(NULL)");
   }
+
+  {
+    struct AddressList *al = mutt_addrlist_new();
+    int parsed =
+        mutt_addrlist_parse(al, "john@doe.org, foo@example.com, bar@baz.org");
+    TEST_CHECK(parsed == 3);
+    TEST_CHECK_STR_EQ(TAILQ_FIRST(al)->mailbox, "john@doe.org");
+    TEST_CHECK_STR_EQ(TAILQ_LAST(al, AddressList)->mailbox, "bar@baz.org");
+    mutt_addrlist_free(&al);
+    TEST_CHECK(al == NULL);
+  }
 }