]> granicus.if.org Git - neomutt/commitdiff
test: templates for url functions
authorRichard Russon <rich@flatcap.org>
Sun, 28 Apr 2019 13:13:47 +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/url/main.c [new file with mode: 0644]
test/url/url_check_scheme.c [new file with mode: 0644]
test/url/url_free.c [new file with mode: 0644]
test/url/url_parse.c [new file with mode: 0644]
test/url/url_pct_decode.c [new file with mode: 0644]
test/url/url_pct_encode.c [new file with mode: 0644]
test/url/url_tobuffer.c [new file with mode: 0644]
test/url/url_tostring.c [new file with mode: 0644]

index df8b7650c19ee44ba6fe8ba8a3f9be52afdd6d9f..34272350bf957490cf19f2f8057ed98acae7e8ee 100644 (file)
@@ -46,6 +46,7 @@ test/signal-test
 test/string-test
 test/tags-test
 test/thread-test
+test/url-test
 
 # Build products
 *.o
index 2cd533575c5f37f0ef981b3a25888b35c217f4a4..c062dafd1c3fb703284db5d6852ee63b73aee498 100644 (file)
@@ -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 (file)
index 0000000..f2f91d9
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * @file
+ * Test code for url 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_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 (file)
index 0000000..62324b4
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * @file
+ * Test code for url_check_scheme()
+ *
+ * @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_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 (file)
index 0000000..0289d63
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * @file
+ * Test code for url_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"
+#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 (file)
index 0000000..d50cdab
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * @file
+ * Test code for url_parse()
+ *
+ * @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_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 (file)
index 0000000..7a9f448
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * @file
+ * Test code for url_pct_decode()
+ *
+ * @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_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 (file)
index 0000000..a932a69
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * @file
+ * Test code for url_pct_encode()
+ *
+ * @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_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 (file)
index 0000000..6014be7
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * @file
+ * Test code for url_tobuffer()
+ *
+ * @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_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 (file)
index 0000000..305f664
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+ * @file
+ * Test code for url_tostring()
+ *
+ * @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_url_tostring(void)
+{
+  // int url_tostring(struct Url *u, char *dest, size_t len, int flags);
+}