From: Pietro Cerutti Date: Sat, 18 May 2019 16:51:50 +0000 (+0000) Subject: Add test for mutt_addrlist_append and mutt_addrlist_prepend X-Git-Tag: 2019-10-25~200^2~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=24071929875b21f8b6c4f715b8ee345eade161ac;p=neomutt Add test for mutt_addrlist_append and mutt_addrlist_prepend --- diff --git a/test/address/mutt_addrlist_append.c b/test/address/mutt_addrlist_append.c index 586760796..814c62888 100644 --- a/test/address/mutt_addrlist_append.c +++ b/test/address/mutt_addrlist_append.c @@ -22,6 +22,7 @@ #define TEST_NO_MAIN #include "acutest.h" +#include "common.h" #include "config.h" #include "mutt/mutt.h" #include "address/lib.h" @@ -41,4 +42,16 @@ void test_mutt_addrlist_append(void) mutt_addrlist_append(&al, NULL); TEST_CHECK_(1, "mutt_addrlist_append(&al, NULL)"); } + + { + struct Address a1 = { .mailbox = "test@example.com" }; + struct Address a2 = { .mailbox = "john@doe.org" }; + struct AddressList al = TAILQ_HEAD_INITIALIZER(al); + mutt_addrlist_append(&al, &a1); + mutt_addrlist_append(&al, &a2); + struct Address *a = TAILQ_FIRST(&al); + TEST_CHECK_STR_EQ("test@example.com", a->mailbox); + a = TAILQ_NEXT(a, entries); + TEST_CHECK_STR_EQ("john@doe.org", a->mailbox); + } } diff --git a/test/address/mutt_addrlist_prepend.c b/test/address/mutt_addrlist_prepend.c index 906c0dc5d..986bffac3 100644 --- a/test/address/mutt_addrlist_prepend.c +++ b/test/address/mutt_addrlist_prepend.c @@ -22,6 +22,7 @@ #define TEST_NO_MAIN #include "acutest.h" +#include "common.h" #include "config.h" #include "mutt/mutt.h" #include "address/lib.h" @@ -41,4 +42,16 @@ void test_mutt_addrlist_prepend(void) mutt_addrlist_prepend(&al, NULL); TEST_CHECK_(1, "mutt_addrlist_prepend(&al, NULL)"); } + + { + struct Address a1 = { .mailbox = "test@example.com" }; + struct Address a2 = { .mailbox = "john@doe.org" }; + struct AddressList al = TAILQ_HEAD_INITIALIZER(al); + mutt_addrlist_prepend(&al, &a1); + mutt_addrlist_prepend(&al, &a2); + struct Address *a = TAILQ_FIRST(&al); + TEST_CHECK_STR_EQ("john@doe.org", a->mailbox); + a = TAILQ_NEXT(a, entries); + TEST_CHECK_STR_EQ("test@example.com", a->mailbox); + } }