1 /**
2  * @file
3  * Test code for mutt_regexlist_add()
4  *
5  * @authors
6  * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
7  *
8  * @copyright
9  * This program is free software: you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License as published by the Free Software
11  * Foundation, either version 2 of the License, or (at your option) any later
12  * version.
13  *
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17  * details.
18  *
19  * You should have received a copy of the GNU General Public License along with
20  * this program.  If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #define TEST_NO_MAIN
24 #include "config.h"
25 #include "acutest.h"
26 #include "mutt/lib.h"
27 
test_mutt_regexlist_add(void)28 void test_mutt_regexlist_add(void)
29 {
30   // int mutt_regexlist_add(struct RegexList *rl, const char *str, uint16_t flags, struct Buffer *err);
31 
32   {
33     struct Buffer buf = mutt_buffer_make(0);
34     TEST_CHECK(mutt_regexlist_add(NULL, "apple", 0, &buf) == 0);
35   }
36 
37   {
38     struct RegexList regexlist = { 0 };
39     struct Buffer buf = mutt_buffer_make(0);
40     TEST_CHECK(mutt_regexlist_add(&regexlist, NULL, 0, &buf) == 0);
41   }
42 
43   {
44     struct RegexList regexlist = STAILQ_HEAD_INITIALIZER(regexlist);
45     TEST_CHECK(mutt_regexlist_add(&regexlist, "apple", 0, NULL) == 0);
46     mutt_regexlist_free(&regexlist);
47   }
48 }
49