]> granicus.if.org Git - neomutt/commitdiff
test: templates for history functions
authorRichard Russon <rich@flatcap.org>
Sun, 28 Apr 2019 11:37:15 +0000 (12:37 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 30 Apr 2019 10:19:58 +0000 (11:19 +0100)
13 files changed:
.gitignore
test/Makefile.autosetup
test/history/main.c [new file with mode: 0644]
test/history/mutt_hist_add.c [new file with mode: 0644]
test/history/mutt_hist_at_scratch.c [new file with mode: 0644]
test/history/mutt_hist_free.c [new file with mode: 0644]
test/history/mutt_hist_init.c [new file with mode: 0644]
test/history/mutt_hist_next.c [new file with mode: 0644]
test/history/mutt_hist_prev.c [new file with mode: 0644]
test/history/mutt_hist_read_file.c [new file with mode: 0644]
test/history/mutt_hist_reset_state.c [new file with mode: 0644]
test/history/mutt_hist_save_scratch.c [new file with mode: 0644]
test/history/mutt_hist_search.c [new file with mode: 0644]

index f2d264a6d0591539fb52cb9b1a1a66c4fb6f487f..f1566232098f7cf46e09cc3e47cd092be37e5dd1 100644 (file)
@@ -20,6 +20,7 @@ test/envlist-test
 test/file-test
 test/group-test
 test/hash-test
+test/history-test
 test/idna-test
 test/neomutt-test
 test/path-test
index 8305567927b3fdb18bfabbe342c25b0111adcf5d..df94d977c8a4e2642b560bce4494fd94cbcd346d 100644 (file)
@@ -188,6 +188,18 @@ HASH_OBJS  = test/hash/main.o \
                  test/hash/mutt_hash_typed_insert.o \
                  test/hash/mutt_hash_walk.o
 
+HISTORY_OBJS   = test/history/main.o \
+                 test/history/mutt_hist_add.o \
+                 test/history/mutt_hist_at_scratch.o \
+                 test/history/mutt_hist_free.o \
+                 test/history/mutt_hist_init.o \
+                 test/history/mutt_hist_next.o \
+                 test/history/mutt_hist_prev.o \
+                 test/history/mutt_hist_read_file.o \
+                 test/history/mutt_hist_reset_state.o \
+                 test/history/mutt_hist_save_scratch.o \
+                 test/history/mutt_hist_search.o
+
 IDNA_OBJS      = test/idna/main.o \
                  test/idna/mutt_idna_intl_to_local.o \
                  test/idna/mutt_idna_local_to_intl.o \
@@ -289,6 +301,8 @@ TEST_GROUP = test/group-test$(EXEEXT)
 
 TEST_HASH = test/hash-test$(EXEEXT)
 
+TEST_HISTORY = test/history-test$(EXEEXT)
+
 TEST_IDNA = test/idna-test$(EXEEXT)
 
 TEST_PATH = test/path-test$(EXEEXT)
@@ -298,7 +312,7 @@ TEST_PATTERN = test/pattern-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_IDNA) $(TEST_PATH) $(TEST_PATTERN) $(TEST_STRING)
+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_PATH) $(TEST_PATTERN) $(TEST_STRING)
        $(TEST_BINARY)
        $(TEST_ADDRESS)
        $(TEST_BASE64)
@@ -309,6 +323,7 @@ test: $(TEST_BINARY) $(TEST_ADDRESS) $(TEST_BASE64) $(TEST_BUFFER) $(TEST_CHARSE
        $(TEST_FILE)
        $(TEST_GROUP)
        $(TEST_HASH)
+       $(TEST_HISTORY)
        $(TEST_IDNA)
        $(TEST_PATH)
        $(TEST_PATTERN)
@@ -347,6 +362,9 @@ $(TEST_GROUP): $(PWD)/test/group $(GROUP_OBJS) $(MUTTLIBS)
 $(TEST_HASH): $(PWD)/test/hash $(HASH_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(HASH_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
+$(TEST_HISTORY): $(PWD)/test/history $(HISTORY_OBJS) $(MUTTLIBS)
+       $(CC) -o $@ $(HISTORY_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
+
 $(TEST_IDNA): $(PWD)/test/idna $(IDNA_OBJS) $(MUTTLIBS)
        $(CC) -o $@ $(IDNA_OBJS) $(MUTTLIBS) $(LDFLAGS) $(LIBS)
 
@@ -389,6 +407,9 @@ $(PWD)/test/group:
 $(PWD)/test/hash:
        $(MKDIR_P) $(PWD)/test/hash
 
+$(PWD)/test/history:
+       $(MKDIR_P) $(PWD)/test/history
+
 $(PWD)/test/idna:
        $(MKDIR_P) $(PWD)/test/idna
 
@@ -401,7 +422,7 @@ $(PWD)/test/pattern:
 $(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_IDNA) $(TEST_PATH) $(TEST_PATTERN) $(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_PATH) $(TEST_PATTERN) $(TEST_STRING)
 
 clean-test:
        $(RM) $(TEST_BINARY) $(TEST_OBJS) $(TEST_OBJS:.o=.Po) \
@@ -414,6 +435,7 @@ clean-test:
              $(TEST_FILE) $(FILE_OBJS) $(FILE_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) \
              $(TEST_IDNA) $(IDNA_OBJS) $(IDNA_OBJS:.o=.Po) \
              $(TEST_PATH) $(PATH_OBJS) $(PATH_OBJS:.o=.Po) \
              $(TEST_PATTERN) $(PATTERN_OBJS) $(PATTERN_OBJS:.o=.Po) \
@@ -455,6 +477,9 @@ GROUP_DEPFILES = $(GROUP_OBJS:.o=.Po)
 HASH_DEPFILES = $(HASH_OBJS:.o=.Po)
 -include $(HASH_DEPFILES)
 
+HISTORY_DEPFILES = $(HISTORY_OBJS:.o=.Po)
+-include $(HISTORY_DEPFILES)
+
 IDNA_DEPFILES = $(IDNA_OBJS:.o=.Po)
 -include $(IDNA_DEPFILES)
 
diff --git a/test/history/main.c b/test/history/main.c
new file mode 100644 (file)
index 0000000..133bd02
--- /dev/null
@@ -0,0 +1,52 @@
+/**
+ * @file
+ * Test code for history 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_mutt_hist_add)                                        \
+  NEOMUTT_TEST_ITEM(test_mutt_hist_at_scratch)                                 \
+  NEOMUTT_TEST_ITEM(test_mutt_hist_free)                                       \
+  NEOMUTT_TEST_ITEM(test_mutt_hist_init)                                       \
+  NEOMUTT_TEST_ITEM(test_mutt_hist_next)                                       \
+  NEOMUTT_TEST_ITEM(test_mutt_hist_prev)                                       \
+  NEOMUTT_TEST_ITEM(test_mutt_hist_read_file)                                  \
+  NEOMUTT_TEST_ITEM(test_mutt_hist_reset_state)                                \
+  NEOMUTT_TEST_ITEM(test_mutt_hist_save_scratch)                               \
+  NEOMUTT_TEST_ITEM(test_mutt_hist_search)
+
+/******************************************************************************
+ * 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/history/mutt_hist_add.c b/test/history/mutt_hist_add.c
new file mode 100644 (file)
index 0000000..bfc5be7
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_hist_add()
+ *
+ * @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"
+
+void test_mutt_hist_add(void)
+{
+  // void mutt_hist_add(enum HistoryClass hclass, const char *str, bool save);
+}
diff --git a/test/history/mutt_hist_at_scratch.c b/test/history/mutt_hist_at_scratch.c
new file mode 100644 (file)
index 0000000..bd3d782
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_hist_at_scratch()
+ *
+ * @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"
+
+void test_mutt_hist_at_scratch(void)
+{
+  // bool mutt_hist_at_scratch(enum HistoryClass hclass);
+}
diff --git a/test/history/mutt_hist_free.c b/test/history/mutt_hist_free.c
new file mode 100644 (file)
index 0000000..cf957be
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_hist_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"
+
+void test_mutt_hist_free(void)
+{
+  // void mutt_hist_free(void);
+}
diff --git a/test/history/mutt_hist_init.c b/test/history/mutt_hist_init.c
new file mode 100644 (file)
index 0000000..61540da
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_hist_init()
+ *
+ * @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"
+
+void test_mutt_hist_init(void)
+{
+  // void mutt_hist_init(void);
+}
diff --git a/test/history/mutt_hist_next.c b/test/history/mutt_hist_next.c
new file mode 100644 (file)
index 0000000..b7be3d1
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_hist_next()
+ *
+ * @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"
+
+void test_mutt_hist_next(void)
+{
+  // char *mutt_hist_next(enum HistoryClass hclass);
+}
diff --git a/test/history/mutt_hist_prev.c b/test/history/mutt_hist_prev.c
new file mode 100644 (file)
index 0000000..c9d290b
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_hist_prev()
+ *
+ * @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"
+
+void test_mutt_hist_prev(void)
+{
+  // char *mutt_hist_prev(enum HistoryClass hclass);
+}
diff --git a/test/history/mutt_hist_read_file.c b/test/history/mutt_hist_read_file.c
new file mode 100644 (file)
index 0000000..07a397e
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_hist_read_file()
+ *
+ * @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"
+
+void test_mutt_hist_read_file(void)
+{
+  // void mutt_hist_read_file(void);
+}
diff --git a/test/history/mutt_hist_reset_state.c b/test/history/mutt_hist_reset_state.c
new file mode 100644 (file)
index 0000000..ffd5b57
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_hist_reset_state()
+ *
+ * @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"
+
+void test_mutt_hist_reset_state(void)
+{
+  // void mutt_hist_reset_state(enum HistoryClass hclass);
+}
diff --git a/test/history/mutt_hist_save_scratch.c b/test/history/mutt_hist_save_scratch.c
new file mode 100644 (file)
index 0000000..904770f
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_hist_save_scratch()
+ *
+ * @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"
+
+void test_mutt_hist_save_scratch(void)
+{
+  // void mutt_hist_save_scratch(enum HistoryClass hclass, const char *str);
+}
diff --git a/test/history/mutt_hist_search.c b/test/history/mutt_hist_search.c
new file mode 100644 (file)
index 0000000..dd1292d
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ * @file
+ * Test code for mutt_hist_search()
+ *
+ * @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"
+
+void test_mutt_hist_search(void)
+{
+  // int mutt_hist_search(const char *search_buf, enum HistoryClass hclass, char **matches);
+}