From: Richard Russon Date: Sun, 28 Apr 2019 13:13:47 +0000 (+0100) Subject: test: templates for url functions X-Git-Tag: 2019-10-25~233^2~28 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b3bb6f8d2697fb72c98bcdb403fffee16c5f06f6;p=neomutt test: templates for url functions --- diff --git a/.gitignore b/.gitignore index df8b7650c..34272350b 100644 --- a/.gitignore +++ b/.gitignore @@ -46,6 +46,7 @@ test/signal-test test/string-test test/tags-test test/thread-test +test/url-test # Build products *.o diff --git a/test/Makefile.autosetup b/test/Makefile.autosetup index 2cd533575..c062dafd1 100644 --- a/test/Makefile.autosetup +++ b/test/Makefile.autosetup @@ -453,6 +453,15 @@ THREAD_OBJS = test/thread/main.o \ test/thread/find_virtual.o \ test/thread/insert_message.o +URL_OBJS = test/url/main.o \ + test/url/url_pct_encode.o \ + test/url/url_check_scheme.o \ + test/url/url_parse.o \ + test/url/url_free.o \ + test/url/url_tostring.o \ + test/url/url_pct_decode.o \ + test/url/url_tobuffer.o + CFLAGS += -I$(SRCDIR)/test TEST_BINARY = test/neomutt-test$(EXEEXT) @@ -527,8 +536,10 @@ TEST_TAGS = test/tags-test$(EXEEXT) TEST_THREAD = test/thread-test$(EXEEXT) +TEST_URL = test/url-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_TAGS) $(TEST_THREAD) +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_THREAD) $(TEST_URL) $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) @@ -564,6 +575,7 @@ test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_ATTACH) $(TEST_BASE64) $(TEST_BODY) $(TEST_STRING) $(TEST_TAGS) $(TEST_THREAD) + $(TEST_URL) $(TEST_BINARY): $(TEST_OBJS) $(MUTTLIBS) $(CC) -o $@ $(TEST_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) @@ -673,6 +685,9 @@ $(TEST_TAGS): $(PWD)/test/tags $(TAGS_OBJS) $(MUTTLIBS) $(TEST_THREAD): $(PWD)/test/thread $(THREAD_OBJS) $(MUTTLIBS) $(CC) -o $@ $(THREAD_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) +$(TEST_URL): $(PWD)/test/url $(URL_OBJS) $(MUTTLIBS) + $(CC) -o $@ $(URL_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS) + $(PWD)/test/address: $(MKDIR_P) $(PWD)/test/address @@ -778,7 +793,10 @@ $(PWD)/test/tags: $(PWD)/test/thread: $(MKDIR_P) $(PWD)/test/thread -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) $(TEST_THREAD) +$(PWD)/test/url: + $(MKDIR_P) $(PWD)/test/url + +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) $(TEST_THREAD) $(TEST_URL) clean-test: $(RM) $(TEST_BINARY) $(TEST_OBJS) $(TEST_OBJS:.o=.Po) \ @@ -816,7 +834,8 @@ clean-test: $(TEST_SIGNAL) $(SIGNAL_OBJS) $(SIGNAL_OBJS:.o=.Po) \ $(TEST_STRING) $(STRING_OBJS) $(STRING_OBJS:.o=.Po) \ $(TEST_TAGS) $(TAGS_OBJS) $(TAGS_OBJS:.o=.Po) \ - $(TEST_THREAD) $(THREAD_OBJS) $(THREAD_OBJS:.o=.Po) + $(TEST_THREAD) $(THREAD_OBJS) $(THREAD_OBJS:.o=.Po) \ + $(TEST_URL) $(URL_OBJS) $(URL_OBJS:.o=.Po) install-test: uninstall-test: @@ -929,4 +948,7 @@ TAGS_DEPFILES = $(TAGS_OBJS:.o=.Po) THREAD_DEPFILES = $(THREAD_OBJS:.o=.Po) -include $(THREAD_DEPFILES) +URL_DEPFILES = $(URL_OBJS:.o=.Po) +-include $(URL_DEPFILES) + # vim: set ts=8 noexpandtab: diff --git a/test/url/main.c b/test/url/main.c new file mode 100644 index 000000000..f2f91d9d8 --- /dev/null +++ b/test/url/main.c @@ -0,0 +1,50 @@ +/** + * @file + * Test code for url 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_url_check_scheme) \ + NEOMUTT_TEST_ITEM(test_url_free) \ + NEOMUTT_TEST_ITEM(test_url_parse) \ + NEOMUTT_TEST_ITEM(test_url_pct_decode) \ + NEOMUTT_TEST_ITEM(test_url_pct_encode) \ + NEOMUTT_TEST_ITEM(test_url_tobuffer) \ + NEOMUTT_TEST_ITEM(test_url_tostring) + +/****************************************************************************** + * 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/url/url_check_scheme.c b/test/url/url_check_scheme.c new file mode 100644 index 000000000..62324b442 --- /dev/null +++ b/test/url/url_check_scheme.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for url_check_scheme() + * + * @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_url_check_scheme(void) +{ + // enum UrlScheme url_check_scheme(const char *s); +} diff --git a/test/url/url_free.c b/test/url/url_free.c new file mode 100644 index 000000000..0289d63fb --- /dev/null +++ b/test/url/url_free.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for url_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_url_free(void) +{ + // void url_free(struct Url **u); +} diff --git a/test/url/url_parse.c b/test/url/url_parse.c new file mode 100644 index 000000000..d50cdab05 --- /dev/null +++ b/test/url/url_parse.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for url_parse() + * + * @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_url_parse(void) +{ + // struct Url *url_parse(const char *src); +} diff --git a/test/url/url_pct_decode.c b/test/url/url_pct_decode.c new file mode 100644 index 000000000..7a9f448f1 --- /dev/null +++ b/test/url/url_pct_decode.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for url_pct_decode() + * + * @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_url_pct_decode(void) +{ + // int url_pct_decode(char *s); +} diff --git a/test/url/url_pct_encode.c b/test/url/url_pct_encode.c new file mode 100644 index 000000000..a932a69aa --- /dev/null +++ b/test/url/url_pct_encode.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for url_pct_encode() + * + * @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_url_pct_encode(void) +{ + // void url_pct_encode(char *buf, size_t buflen, const char *src); +} diff --git a/test/url/url_tobuffer.c b/test/url/url_tobuffer.c new file mode 100644 index 000000000..6014be7d9 --- /dev/null +++ b/test/url/url_tobuffer.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for url_tobuffer() + * + * @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_url_tobuffer(void) +{ + // int url_tobuffer(struct Url *u, struct Buffer *buf, int flags); +} diff --git a/test/url/url_tostring.c b/test/url/url_tostring.c new file mode 100644 index 000000000..305f66430 --- /dev/null +++ b/test/url/url_tostring.c @@ -0,0 +1,33 @@ +/** + * @file + * Test code for url_tostring() + * + * @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_url_tostring(void) +{ + // int url_tostring(struct Url *u, char *dest, size_t len, int flags); +}