]> granicus.if.org Git - neomutt/commitdiff
test: templates for from functions
authorRichard Russon <rich@flatcap.org>
Sun, 28 Apr 2019 13:13:46 +0000 (14:13 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 30 Apr 2019 10:22:04 +0000 (11:22 +0100)
.gitignore
test/Makefile.autosetup
test/from/is_from.c [new file with mode: 0644]
test/from/main.c [new file with mode: 0644]

index 1f64eaaa5c474cd4d7c0ad045541527d5ee54ca9..9224eee0753b260116ff2e491d58a0c2a6382143 100644 (file)
@@ -22,6 +22,7 @@ test/email-test
 test/envelope-test
 test/envlist-test
 test/file-test
+test/from-test
 test/group-test
 test/hash-test
 test/history-test
index 1c5cd57e418f81f7dec12e8ca277d5147c1f4659..4b15c2a695c7968456928c053be2a1c910cf382d 100644 (file)
@@ -185,6 +185,9 @@ FILE_OBJS   = test/file/main.o \
                  test/file/mutt_file_unlink_empty.o \
                  test/file/mutt_file_unlock.o
 
+FROM_OBJS      = test/from/main.o \
+                 test/from/is_from.o
+
 GROUP_OBJS     = test/group/main.o \
                  test/group/mutt_grouplist_add_addrlist.o \
                  test/group/mutt_grouplist_add.o \
@@ -423,6 +426,8 @@ TEST_ENVLIST = test/envlist-test$(EXEEXT)
 
 TEST_FILE = test/file-test$(EXEEXT)
 
+TEST_FROM = test/from-test$(EXEEXT)
+
 TEST_GROUP = test/group-test$(EXEEXT)
 
 TEST_HASH = test/hash-test$(EXEEXT)
@@ -456,7 +461,7 @@ TEST_SIGNAL = test/signal-test$(EXEEXT)
 TEST_STRING = test/string-test$(EXEEXT)
 
 .PHONY: test
-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) $(TEST_BASE64) $(TEST_BODY) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_EMAIL) $(TEST_ENVELOPE) $(TEST_ENVLIST) $(TEST_FILE) $(TEST_GROUP) $(TEST_HASH) $(TEST_HISTORY) $(TEST_IDNA) $(TEST_LIST) $(TEST_LOGGING) $(TEST_MAPPING) $(TEST_MBYTE) $(TEST_MD5) $(TEST_MEMORY) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING)
+test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) $(TEST_BASE64) $(TEST_BODY) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_EMAIL) $(TEST_ENVELOPE) $(TEST_ENVLIST) $(TEST_FILE) $(TEST_FROM) $(TEST_GROUP) $(TEST_HASH) $(TEST_HISTORY) $(TEST_IDNA) $(TEST_LIST) $(TEST_LOGGING) $(TEST_MAPPING) $(TEST_MBYTE) $(TEST_MD5) $(TEST_MEMORY) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING)
        $(TEST_BINARY)
        $(TEST_ADDRESS)
        $(TEST_ATTACH)
@@ -469,6 +474,7 @@ test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) $(TEST_BASE64) $(TEST_BODY)
        $(TEST_ENVELOPE)
        $(TEST_ENVLIST)
        $(TEST_FILE)
+       $(TEST_FROM)
        $(TEST_GROUP)
        $(TEST_HASH)
        $(TEST_HISTORY)
@@ -525,6 +531,9 @@ $(TEST_ENVLIST): $(PWD)/test/envlist $(ENVLIST_OBJS) $(MUTTLIBS)
 $(TEST_FILE): $(PWD)/test/file $(FILE_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(FILE_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
+$(TEST_FROM): $(PWD)/test/from $(FROM_OBJS) $(MUTTLIBS)
+       $(CC) -o $@ $(FROM_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
+
 $(TEST_GROUP): $(PWD)/test/group $(GROUP_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(GROUP_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
@@ -609,6 +618,9 @@ $(PWD)/test/envlist:
 $(PWD)/test/file:
        $(MKDIR_P) $(PWD)/test/file
 
+$(PWD)/test/from:
+       $(MKDIR_P) $(PWD)/test/from
+
 $(PWD)/test/group:
        $(MKDIR_P) $(PWD)/test/group
 
@@ -657,7 +669,7 @@ $(PWD)/test/signal:
 $(PWD)/test/string:
        $(MKDIR_P) $(PWD)/test/string
 
-all-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) $(TEST_BASE64) $(TEST_BODY) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_EMAIL) $(TEST_ENVELOPE) $(TEST_ENVLIST) $(TEST_FILE) $(TEST_GROUP) $(TEST_HASH) $(TEST_HISTORY) $(TEST_IDNA) $(TEST_LIST) $(TEST_LOGGING) $(TEST_MAPPING) $(TEST_MBYTE) $(TEST_MD5) $(TEST_MEMORY) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING)
+all-test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) $(TEST_BASE64) $(TEST_BODY) $(TEST_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(TEST_EMAIL) $(TEST_ENVELOPE) $(TEST_ENVLIST) $(TEST_FILE) $(TEST_FROM) $(TEST_GROUP) $(TEST_HASH) $(TEST_HISTORY) $(TEST_IDNA) $(TEST_LIST) $(TEST_LOGGING) $(TEST_MAPPING) $(TEST_MBYTE) $(TEST_MD5) $(TEST_MEMORY) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING)
 
 clean-test:
        $(RM) $(TEST_BINARY) $(TEST_OBJS) $(TEST_OBJS:.o=.Po) \
@@ -673,6 +685,7 @@ clean-test:
              $(TEST_ENVELOPE) $(ENVELOPE_OBJS) $(ENVELOPE_OBJS:.o=.Po) \
              $(TEST_ENVLIST) $(ENVLIST_OBJS) $(ENVLIST_OBJS:.o=.Po) \
              $(TEST_FILE) $(FILE_OBJS) $(FILE_OBJS:.o=.Po) \
+             $(TEST_FROM) $(FROM_OBJS) $(FROM_OBJS:.o=.Po) \
              $(TEST_GROUP) $(GROUP_OBJS) $(GROUP_OBJS:.o=.Po) \
              $(TEST_HASH) $(HASH_OBJS) $(HASH_OBJS:.o=.Po) \
              $(TEST_HISTORY) $(HISTORY_OBJS) $(HISTORY_OBJS:.o=.Po) \
@@ -732,6 +745,9 @@ ENVLIST_DEPFILES = $(ENVLIST_OBJS:.o=.Po)
 FILE_DEPFILES = $(FILE_OBJS:.o=.Po)
 -include $(FILE_DEPFILES)
 
+FROM_DEPFILES = $(FROM_OBJS:.o=.Po)
+-include $(FROM_DEPFILES)
+
 GROUP_DEPFILES = $(GROUP_OBJS:.o=.Po)
 -include $(GROUP_DEPFILES)
 
diff --git a/test/from/is_from.c b/test/from/is_from.c
new file mode 100644 (file)
index 0000000..9520597
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * @file
+ * Test code for is_from()
+ *
+ * @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"
+#include "email/lib.h"
+#include "address/lib.h"
+
+void test_is_from(void)
+{
+  // bool is_from(const char *s, char *path, size_t pathlen, time_t *tp);
+}
diff --git a/test/from/main.c b/test/from/main.c
new file mode 100644 (file)
index 0000000..bb77a26
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * @file
+ * Test code for from 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_is_from)
+
+/******************************************************************************
+ * 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 }
+};
+