From: Richard Russon Date: Sun, 28 Apr 2019 13:13:46 +0000 (+0100) Subject: test: templates for attach functions X-Git-Tag: 2019-10-25~233^2~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=625606c1046dc3f4f169de9cc704faae11f48a78;p=neomutt test: templates for attach functions --- diff --git a/.gitignore b/.gitignore index aff4ade2f..ca9616b19 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ doc/makedoc neomutt pgpewrap test/address-test +test/attach-test test/base64-test test/buffer-test test/charset-test diff --git a/Makefile.autosetup b/Makefile.autosetup index 580e02c35..201beca50 100644 --- a/Makefile.autosetup +++ b/Makefile.autosetup @@ -446,7 +446,7 @@ distclean: clean # coverage testing coverage: all test $(RM) lcov - lcov -t "test" -o lcov.info -c -d address -d config -d mutt + lcov -t "test" -o lcov.info -c -d address -d config -d email -d mutt -genhtml -o lcov lcov.info -f lcov -l lcov.info diff --git a/test/Makefile.autosetup b/test/Makefile.autosetup index ff5061887..41f54ca95 100644 --- a/test/Makefile.autosetup +++ b/test/Makefile.autosetup @@ -35,6 +35,13 @@ ADDRESS_OBJS = test/address/main.o \ test/address/mutt_addr_write.o \ test/address/mutt_addr_write_single.o +ATTACH_OBJS = test/attach/main.o \ + test/attach/mutt_actx_add_fp.o \ + test/attach/mutt_actx_free_entries.o \ + test/attach/mutt_actx_free.o \ + test/attach/mutt_actx_add_body.o \ + test/attach/mutt_actx_add_attach.o + BASE64_OBJS = test/base64/main.o \ test/base64/mutt_b64_buffer_decode.o \ test/base64/mutt_b64_buffer_encode.o \ @@ -375,6 +382,8 @@ TEST_BINARY = test/neomutt-test$(EXEEXT) TEST_ADDRESS = test/address-test$(EXEEXT) +TEST_ATTACH = test/attach-test$(EXEEXT) + TEST_BASE64 = test/base64-test$(EXEEXT) TEST_BUFFER = test/buffer-test$(EXEEXT) @@ -422,9 +431,10 @@ TEST_SIGNAL = test/signal-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_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_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(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_BINARY) $(TEST_ADDRESS) + $(TEST_ATTACH) $(TEST_BASE64) $(TEST_BUFFER) $(TEST_CONFIG) @@ -454,6 +464,9 @@ $(TEST_BINARY): $(TEST_OBJS) $(MUTTLIBS) $(TEST_ADDRESS): $(PWD)/test/address $(ADDRESS_OBJS) $(MUTTLIBS) $(CC) -o $@ $(ADDRESS_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) +$(TEST_ATTACH): $(PWD)/test/attach $(ATTACH_OBJS) $(MUTTLIBS) + $(CC) -o $@ $(ATTACH_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) + $(TEST_BASE64): $(PWD)/test/base64 $(BASE64_OBJS) $(MUTTLIBS) $(CC) -o $@ $(BASE64_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) @@ -526,6 +539,9 @@ $(TEST_STRING): $(PWD)/test/string $(STRING_OBJS) $(MUTTLIBS) $(PWD)/test/address: $(MKDIR_P) $(PWD)/test/address +$(PWD)/test/attach: + $(MKDIR_P) $(PWD)/test/attach + $(PWD)/test/base64: $(MKDIR_P) $(PWD)/test/base64 @@ -595,11 +611,12 @@ $(PWD)/test/signal: $(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_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_BUFFER) $(TEST_CHARSET) $(TEST_CONFIG) $(TEST_DATE) $(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) clean-test: $(RM) $(TEST_BINARY) $(TEST_OBJS) $(TEST_OBJS:.o=.Po) \ $(TEST_ADDRESS) $(ADDRESS_OBJS) $(ADDRESS_OBJS:.o=.Po) \ + $(TEST_ATTACH) $(ATTACH_OBJS) $(ATTACH_OBJS:.o=.Po) \ $(TEST_BASE64) $(BASE64_OBJS) $(BASE64_OBJS:.o=.Po) \ $(TEST_CHARSET) $(CHARSET_OBJS) $(CHARSET_OBJS:.o=.Po) \ $(TEST_CONFIG) $(CONFIG_OBJS) $(CONFIG_OBJS:.o=.Po) \ @@ -632,6 +649,9 @@ TEST_DEPFILES = $(TEST_OBJS:.o=.Po) ADDRESS_DEPFILES = $(ADDRESS_OBJS:.o=.Po) -include $(ADDRESS_DEPFILES) +ATTACH_DEPFILES = $(ATTACH_OBJS:.o=.Po) +-include $(ATTACH_DEPFILES) + BASE64_DEPFILES = $(BASE64_OBJS:.o=.Po) -include $(BASE64_DEPFILES) diff --git a/test/attach/main.c b/test/attach/main.c new file mode 100644 index 000000000..7c951b21d --- /dev/null +++ b/test/attach/main.c @@ -0,0 +1,48 @@ +/** + * @file + * Test code for attach Operations + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @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 . + */ + +#include "acutest.h" + +/****************************************************************************** + * Add your test cases to this list. + *****************************************************************************/ +#define NEOMUTT_TEST_LIST \ + NEOMUTT_TEST_ITEM(test_mutt_actx_add_attach) \ + NEOMUTT_TEST_ITEM(test_mutt_actx_add_body) \ + NEOMUTT_TEST_ITEM(test_mutt_actx_add_fp) \ + NEOMUTT_TEST_ITEM(test_mutt_actx_free) \ + NEOMUTT_TEST_ITEM(test_mutt_actx_free_entries) + +/****************************************************************************** + * 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/attach/mutt_actx_add_attach.c b/test/attach/mutt_actx_add_attach.c new file mode 100644 index 000000000..5b088c806 --- /dev/null +++ b/test/attach/mutt_actx_add_attach.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for mutt_actx_add_attach() + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @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 . + */ + +#define TEST_NO_MAIN +#include "acutest.h" +#include "config.h" +#include "mutt/mutt.h" +#include "email/lib.h" +#include "address/lib.h" + +void test_mutt_actx_add_attach(void) +{ + // void mutt_actx_add_attach(struct AttachCtx *actx, struct AttachPtr *attach); +} diff --git a/test/attach/mutt_actx_add_body.c b/test/attach/mutt_actx_add_body.c new file mode 100644 index 000000000..87767f8bc --- /dev/null +++ b/test/attach/mutt_actx_add_body.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for mutt_actx_add_body() + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @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 . + */ + +#define TEST_NO_MAIN +#include "acutest.h" +#include "config.h" +#include "mutt/mutt.h" +#include "email/lib.h" +#include "address/lib.h" + +void test_mutt_actx_add_body(void) +{ + // void mutt_actx_add_body(struct AttachCtx *actx, struct Body *new_body); +} diff --git a/test/attach/mutt_actx_add_fp.c b/test/attach/mutt_actx_add_fp.c new file mode 100644 index 000000000..6175a7db9 --- /dev/null +++ b/test/attach/mutt_actx_add_fp.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for mutt_actx_add_fp() + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @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 . + */ + +#define TEST_NO_MAIN +#include "acutest.h" +#include "config.h" +#include "mutt/mutt.h" +#include "email/lib.h" +#include "address/lib.h" + +void test_mutt_actx_add_fp(void) +{ + // void mutt_actx_add_fp(struct AttachCtx *actx, FILE *fp_new); +} diff --git a/test/attach/mutt_actx_free.c b/test/attach/mutt_actx_free.c new file mode 100644 index 000000000..9b67c6b35 --- /dev/null +++ b/test/attach/mutt_actx_free.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for mutt_actx_free() + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @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 . + */ + +#define TEST_NO_MAIN +#include "acutest.h" +#include "config.h" +#include "mutt/mutt.h" +#include "email/lib.h" +#include "address/lib.h" + +void test_mutt_actx_free(void) +{ + // void mutt_actx_free(struct AttachCtx **pactx); +} diff --git a/test/attach/mutt_actx_free_entries.c b/test/attach/mutt_actx_free_entries.c new file mode 100644 index 000000000..cf7aa698f --- /dev/null +++ b/test/attach/mutt_actx_free_entries.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for mutt_actx_free_entries() + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @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 . + */ + +#define TEST_NO_MAIN +#include "acutest.h" +#include "config.h" +#include "mutt/mutt.h" +#include "email/lib.h" +#include "address/lib.h" + +void test_mutt_actx_free_entries(void) +{ + // void mutt_actx_free_entries(struct AttachCtx *actx); +}