From: Richard Russon Date: Sun, 28 Apr 2019 13:14:37 +0000 (+0100) Subject: test: templates for tags functions X-Git-Tag: 2019-10-25~233^2~32 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=94022be6e8b291250350c40bdb0f6dfa89b2f7e6;p=neomutt test: templates for tags functions --- diff --git a/.gitignore b/.gitignore index a4f844cae..ed6c3ef8a 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ test/rfc2231-test test/sha1-test test/signal-test test/string-test +test/tags-test # Build products *.o diff --git a/test/Makefile.autosetup b/test/Makefile.autosetup index 1c20af71f..a6c211717 100644 --- a/test/Makefile.autosetup +++ b/test/Makefile.autosetup @@ -436,6 +436,14 @@ STRING_OBJS = test/string/main.o \ test/string/mutt_str_sysexit.o \ test/string/mutt_str_word_casecmp.o +TAGS_OBJS = test/tags/main.o \ + test/tags/driver_tags_get.o \ + test/tags/driver_tags_replace.o \ + test/tags/driver_tags_get_transformed.o \ + test/tags/driver_tags_get_with_hidden.o \ + test/tags/driver_tags_free.o \ + test/tags/driver_tags_get_transformed_for.o + CFLAGS += -I$(SRCDIR)/test TEST_BINARY = test/neomutt-test$(EXEEXT) @@ -506,8 +514,10 @@ TEST_SIGNAL = test/signal-test$(EXEEXT) TEST_STRING = test/string-test$(EXEEXT) +TEST_TAGS = test/tags-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_FROM) $(TEST_GROUP) $(TEST_HASH) $(TEST_HISTORY) $(TEST_IDNA) $(TEST_LIST) $(TEST_LOGGING) $(TEST_MAPPING) $(TEST_MBYTE) $(TEST_MD5) $(TEST_MEMORY) $(TEST_PARAMETER) $(TEST_PARSE) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_RFC2047) $(TEST_RFC2231) $(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_PARAMETER) $(TEST_PARSE) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_RFC2047) $(TEST_RFC2231) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING) $(TEST_TAGS) $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) @@ -541,6 +551,7 @@ test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) $(TEST_BASE64) $(TEST_BODY) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING) + $(TEST_TAGS) $(TEST_BINARY): $(TEST_OBJS) $(MUTTLIBS) $(CC) -o $@ $(TEST_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) @@ -644,6 +655,9 @@ $(TEST_SIGNAL): $(PWD)/test/signal $(SIGNAL_OBJS) $(MUTTLIBS) $(TEST_STRING): $(PWD)/test/string $(STRING_OBJS) $(MUTTLIBS) $(CC) -o $@ $(STRING_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) +$(TEST_TAGS): $(PWD)/test/tags $(TAGS_OBJS) $(MUTTLIBS) + $(CC) -o $@ $(TAGS_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) + $(PWD)/test/address: $(MKDIR_P) $(PWD)/test/address @@ -743,7 +757,10 @@ $(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_FROM) $(TEST_GROUP) $(TEST_HASH) $(TEST_HISTORY) $(TEST_IDNA) $(TEST_LIST) $(TEST_LOGGING) $(TEST_MAPPING) $(TEST_MBYTE) $(TEST_MD5) $(TEST_MEMORY) $(TEST_PARAMETER) $(TEST_PARSE) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_RFC2047) $(TEST_RFC2231) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING) +$(PWD)/test/tags: + $(MKDIR_P) $(PWD)/test/tags + +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_PARAMETER) $(TEST_PARSE) $(TEST_PATH) $(TEST_PATTERN) $(TEST_REGEX) $(TEST_RFC2047) $(TEST_RFC2231) $(TEST_SHA1) $(TEST_SIGNAL) $(TEST_STRING) $(TEST_TAGS) clean-test: $(RM) $(TEST_BINARY) $(TEST_OBJS) $(TEST_OBJS:.o=.Po) \ @@ -779,7 +796,8 @@ clean-test: $(TEST_RFC2231) $(RFC2231_OBJS) $(RFC2231_OBJS:.o=.Po) \ $(TEST_SHA1) $(SHA1_OBJS) $(SHA1_OBJS:.o=.Po) \ $(TEST_SIGNAL) $(SIGNAL_OBJS) $(SIGNAL_OBJS:.o=.Po) \ - $(TEST_STRING) $(STRING_OBJS) $(STRING_OBJS:.o=.Po) + $(TEST_STRING) $(STRING_OBJS) $(STRING_OBJS:.o=.Po) \ + $(TEST_TAGS) $(TAGS_OBJS) $(TAGS_OBJS:.o=.Po) install-test: uninstall-test: @@ -886,4 +904,7 @@ SIGNAL_DEPFILES = $(SIGNAL_OBJS:.o=.Po) STRING_DEPFILES = $(STRING_OBJS:.o=.Po) -include $(STRING_DEPFILES) +TAGS_DEPFILES = $(TAGS_OBJS:.o=.Po) +-include $(TAGS_DEPFILES) + # vim: set ts=8 noexpandtab: diff --git a/test/tags/driver_tags_free.c b/test/tags/driver_tags_free.c new file mode 100644 index 000000000..849278a1e --- /dev/null +++ b/test/tags/driver_tags_free.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for driver_tags_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_driver_tags_free(void) +{ + // void driver_tags_free(struct TagHead *head); +} diff --git a/test/tags/driver_tags_get.c b/test/tags/driver_tags_get.c new file mode 100644 index 000000000..7000353ae --- /dev/null +++ b/test/tags/driver_tags_get.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for driver_tags_get() + * + * @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_driver_tags_get(void) +{ + // char *driver_tags_get(struct TagHead *head); +} diff --git a/test/tags/driver_tags_get_transformed.c b/test/tags/driver_tags_get_transformed.c new file mode 100644 index 000000000..f610ba633 --- /dev/null +++ b/test/tags/driver_tags_get_transformed.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for driver_tags_get_transformed() + * + * @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_driver_tags_get_transformed(void) +{ + // char *driver_tags_get_transformed(struct TagHead *head); +} diff --git a/test/tags/driver_tags_get_transformed_for.c b/test/tags/driver_tags_get_transformed_for.c new file mode 100644 index 000000000..e06ae2945 --- /dev/null +++ b/test/tags/driver_tags_get_transformed_for.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for driver_tags_get_transformed_for() + * + * @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_driver_tags_get_transformed_for(void) +{ + // char *driver_tags_get_transformed_for(const char *name, struct TagHead *head); +} diff --git a/test/tags/driver_tags_get_with_hidden.c b/test/tags/driver_tags_get_with_hidden.c new file mode 100644 index 000000000..fbddf1d77 --- /dev/null +++ b/test/tags/driver_tags_get_with_hidden.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for driver_tags_get_with_hidden() + * + * @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_driver_tags_get_with_hidden(void) +{ + // char *driver_tags_get_with_hidden(struct TagHead *head); +} diff --git a/test/tags/driver_tags_replace.c b/test/tags/driver_tags_replace.c new file mode 100644 index 000000000..615f01fa0 --- /dev/null +++ b/test/tags/driver_tags_replace.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for driver_tags_replace() + * + * @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_driver_tags_replace(void) +{ + // bool driver_tags_replace(struct TagHead *head, char *tags); +} diff --git a/test/tags/main.c b/test/tags/main.c new file mode 100644 index 000000000..d39b1f2c8 --- /dev/null +++ b/test/tags/main.c @@ -0,0 +1,49 @@ +/** + * @file + * Test code for tags 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_driver_tags_free) \ + NEOMUTT_TEST_ITEM(test_driver_tags_get) \ + NEOMUTT_TEST_ITEM(test_driver_tags_get_transformed) \ + NEOMUTT_TEST_ITEM(test_driver_tags_get_transformed_for) \ + NEOMUTT_TEST_ITEM(test_driver_tags_get_with_hidden) \ + NEOMUTT_TEST_ITEM(test_driver_tags_replace) + +/****************************************************************************** + * 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 } +}; +