]> granicus.if.org Git - neomutt/commitdiff
test: templates for envlist functions
authorRichard Russon <rich@flatcap.org>
Sun, 28 Apr 2019 11:37:15 +0000 (12:37 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 30 Apr 2019 09:49:17 +0000 (10:49 +0100)
.gitignore
test/Makefile.autosetup
test/envlist/main.c [new file with mode: 0644]
test/envlist/mutt_envlist_free.c [new file with mode: 0644]
test/envlist/mutt_envlist_getlist.c [new file with mode: 0644]
test/envlist/mutt_envlist_init.c [new file with mode: 0644]
test/envlist/mutt_envlist_set.c [new file with mode: 0644]
test/envlist/mutt_envlist_unset.c [new file with mode: 0644]

index c2db22fed4ca8000870edb62c7095a858f68ba7d..1f19509bcb54dc294aef28bcfa11009634c85591 100644 (file)
@@ -16,6 +16,7 @@ test/buffer-test
 test/charset-test
 test/config-test
 test/date-test
+test/envlist-test
 test/group-test
 test/idna-test
 test/neomutt-test
index ae61e26c233f70607b499c00622e77d878021b0f..b8df013481b053b24ca7061c666f2750dae57c1c 100644 (file)
@@ -111,6 +111,13 @@ DATE_OBJS  = test/date/main.o \
                  test/date/mutt_date_parse_date.o \
                  test/date/mutt_date_parse_imap.o
 
+ENVLIST_OBJS   = test/envlist/main.o \
+                 test/envlist/mutt_envlist_free.o \
+                 test/envlist/mutt_envlist_getlist.o \
+                 test/envlist/mutt_envlist_init.o \
+                 test/envlist/mutt_envlist_set.o \
+                 test/envlist/mutt_envlist_unset.o
+
 GROUP_OBJS     = test/group/main.o \
                  test/group/mutt_grouplist_add_addrlist.o \
                  test/group/mutt_grouplist_add.o \
@@ -217,6 +224,8 @@ TEST_CONFIG = test/config-test$(EXEEXT)
 
 TEST_DATE = test/date-test$(EXEEXT)
 
+TEST_ENVLIST = test/envlist-test$(EXEEXT)
+
 TEST_GROUP = test/group-test$(EXEEXT)
 
 TEST_IDNA = test/idna-test$(EXEEXT)
@@ -228,13 +237,14 @@ TEST_PATTERN = test/pattern-test$(EXEEXT)
 TEST_STRING = test/string-test$(EXEEXT)
 
 .PHONY: test
-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_BASE64) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_GROUP) $(TEST_IDNA) $(TEST_PATH) $(TEST_PATTERN) $(TEST_STRING)
+test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_BASE64) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_ENVLIST) $(TEST_GROUP) $(TEST_IDNA) $(TEST_PATH) $(TEST_PATTERN) $(TEST_STRING)
        $(TEST_BINARY)
        $(TEST_ADDRESS)
        $(TEST_BASE64)
        $(TEST_BUFFER)
        $(TEST_CONFIG)
        $(TEST_DATE)
+       $(TEST_ENVLIST)
        $(TEST_GROUP)
        $(TEST_IDNA)
        $(TEST_PATH)
@@ -262,6 +272,9 @@ $(TEST_CONFIG): $(PWD)/test/config $(CONFIG_OBJS) $(MUTTLIBS)
 $(TEST_DATE): $(PWD)/test/date $(DATE_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(DATE_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
+$(TEST_ENVLIST): $(PWD)/test/envlist $(ENVLIST_OBJS) $(MUTTLIBS)
+       $(CC) -o $@ $(ENVLIST_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
+
 $(TEST_GROUP): $(PWD)/test/group $(GROUP_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(GROUP_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
@@ -295,6 +308,9 @@ $(PWD)/test/config:
 $(PWD)/test/date:
        $(MKDIR_P) $(PWD)/test/date
 
+$(PWD)/test/envlist:
+       $(MKDIR_P) $(PWD)/test/envlist
+
 $(PWD)/test/group:
        $(MKDIR_P) $(PWD)/test/group
 
@@ -310,7 +326,7 @@ $(PWD)/test/pattern:
 $(PWD)/test/string:
        $(MKDIR_P) $(PWD)/test/string
 
-all-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_BASE64) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_GROUP) $(TEST_IDNA) $(TEST_PATH) $(TEST_PATTERN) $(TEST_STRING)
+all-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_BASE64) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_ENVLIST) $(TEST_GROUP) $(TEST_IDNA) $(TEST_PATH) $(TEST_PATTERN) $(TEST_STRING)
 
 clean-test:
        $(RM) $(TEST_BINARY) $(TEST_OBJS) $(TEST_OBJS:.o=.Po) \
@@ -319,6 +335,7 @@ clean-test:
              $(TEST_CHARSET) $(CHARSET_OBJS) $(CHARSET_OBJS:.o=.Po) \
              $(TEST_CONFIG) $(CONFIG_OBJS) $(CONFIG_OBJS:.o=.Po) \
              $(TEST_DATE) $(DATE_OBJS) $(DATE_OBJS:.o=.Po) \
+             $(TEST_ENVLIST) $(ENVLIST_OBJS) $(ENVLIST_OBJS:.o=.Po) \
              $(TEST_GROUP) $(GROUP_OBJS) $(GROUP_OBJS:.o=.Po) \
              $(TEST_IDNA) $(IDNA_OBJS) $(IDNA_OBJS:.o=.Po) \
              $(TEST_PATH) $(PATH_OBJS) $(PATH_OBJS:.o=.Po) \
@@ -349,6 +366,9 @@ CONFIG_DEPFILES = $(CONFIG_OBJS:.o=.Po)
 DATE_DEPFILES = $(DATE_OBJS:.o=.Po)
 -include $(DATE_DEPFILES)
 
+ENVLIST_DEPFILES = $(ENVLIST_OBJS:.o=.Po)
+-include $(ENVLIST_DEPFILES)
+
 GROUP_DEPFILES = $(GROUP_OBJS:.o=.Po)
 -include $(GROUP_DEPFILES)
 
diff --git a/test/envlist/main.c b/test/envlist/main.c
new file mode 100644 (file)
index 0000000..8bbc67d
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+ * @file
+ * Test code for envlist Operations
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "acutest.h"
+
+/******************************************************************************
+ * Add your test cases to this list.
+ *****************************************************************************/
+#define NEOMUTT_TEST_LIST                                                      \
+  NEOMUTT_TEST_ITEM(test_mutt_envlist_free)                                    \
+  NEOMUTT_TEST_ITEM(test_mutt_envlist_getlist)                                 \
+  NEOMUTT_TEST_ITEM(test_mutt_envlist_init)                                    \
+  NEOMUTT_TEST_ITEM(test_mutt_envlist_set)                                     \
+  NEOMUTT_TEST_ITEM(test_mutt_envlist_unset)
+
+/******************************************************************************
+ * You probably don't need to touch what follows.
+ *****************************************************************************/
+#define NEOMUTT_TEST_ITEM(x) void x(void);
+NEOMUTT_TEST_LIST
+#undef NEOMUTT_TEST_ITEM
+
+TEST_LIST = {
+#define NEOMUTT_TEST_ITEM(x) { #x, x },
+  NEOMUTT_TEST_LIST
+#undef NEOMUTT_TEST_ITEM
+  { 0 }
+};
diff --git a/test/envlist/mutt_envlist_free.c b/test/envlist/mutt_envlist_free.c
new file mode 100644 (file)
index 0000000..f570e43
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_envlist_free()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+
+void test_mutt_envlist_free(void)
+{
+  // void mutt_envlist_free(void);
+}
diff --git a/test/envlist/mutt_envlist_getlist.c b/test/envlist/mutt_envlist_getlist.c
new file mode 100644 (file)
index 0000000..efae0db
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_envlist_getlist()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+
+void test_mutt_envlist_getlist(void)
+{
+  // char **mutt_envlist_getlist(void);
+}
diff --git a/test/envlist/mutt_envlist_init.c b/test/envlist/mutt_envlist_init.c
new file mode 100644 (file)
index 0000000..e62f9b2
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_envlist_init()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+
+void test_mutt_envlist_init(void)
+{
+  // void mutt_envlist_init(char *envp[]);
+}
diff --git a/test/envlist/mutt_envlist_set.c b/test/envlist/mutt_envlist_set.c
new file mode 100644 (file)
index 0000000..5e9bdf1
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_envlist_set()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+
+void test_mutt_envlist_set(void)
+{
+  // bool mutt_envlist_set(const char *name, const char *value, bool overwrite);
+}
diff --git a/test/envlist/mutt_envlist_unset.c b/test/envlist/mutt_envlist_unset.c
new file mode 100644 (file)
index 0000000..2d92028
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_envlist_unset()
+ *
+ * @authors
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define TEST_NO_MAIN
+#include "acutest.h"
+#include "config.h"
+#include "mutt/mutt.h"
+
+void test_mutt_envlist_unset(void)
+{
+  // bool mutt_envlist_unset(const char *name);
+}