#define TEST_NO_MAIN
#include "acutest.h"
+#include "common.h"
#include "config.h"
#include "mutt/mutt.h"
#include "address/lib.h"
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);
+ }
}
#define TEST_NO_MAIN
#include "acutest.h"
+#include "common.h"
#include "config.h"
#include "mutt/mutt.h"
#include "address/lib.h"
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);
+ }
}