[devhelp] unit-tests: add basic infrastructure for unit tests



commit fce656b6dda494034e7bf8fa45aff8f1a5326faa
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Dec 7 13:09:38 2017 +0100

    unit-tests: add basic infrastructure for unit tests
    
    We live in the 21st century, it's time to add the first unit test for
    Devhelp.

 Makefile.am            |    2 +-
 configure.ac           |    1 +
 unit-tests/Makefile.am |   21 +++++++++++++++++++++
 unit-tests/test-link.c |   34 ++++++++++++++++++++++++++++++++++
 4 files changed, 57 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 37daf17..430a537 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = po src data misc contrib docs
+SUBDIRS = po src unit-tests data misc contrib docs
 
 AM_DISTCHECK_CONFIGURE_FLAGS = \
        --enable-gtk-doc        \
diff --git a/configure.ac b/configure.ac
index 80356b6..7486bae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,6 +92,7 @@ AC_CONFIG_FILES([
        misc/gedit-plugin/Makefile
        po/Makefile.in
        src/Makefile
+       unit-tests/Makefile
 ])
 
 AC_OUTPUT
diff --git a/unit-tests/Makefile.am b/unit-tests/Makefile.am
new file mode 100644
index 0000000..e57e34e
--- /dev/null
+++ b/unit-tests/Makefile.am
@@ -0,0 +1,21 @@
+AM_CPPFLAGS =                  \
+       -I$(top_srcdir)/src     \
+       -I$(top_builddir)/src   \
+       $(WARN_CFLAGS)          \
+       $(DEVHELP_CFLAGS)
+
+AM_LDFLAGS = $(WARN_LDFLAGS)
+
+LDADD = $(top_builddir)/src/libdevhelp-3.la    \
+       $(DEVHELP_LIBS)                         \
+       $(LIBM)
+
+UNIT_TEST_PROGS =
+
+UNIT_TEST_PROGS += test-link
+test_link_SOURCES = test-link.c
+
+noinst_PROGRAMS = $(UNIT_TEST_PROGS)
+TESTS = $(UNIT_TEST_PROGS)
+
+-include $(top_srcdir)/git.mk
diff --git a/unit-tests/test-link.c b/unit-tests/test-link.c
new file mode 100644
index 0000000..c243f2c
--- /dev/null
+++ b/unit-tests/test-link.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2017 Sébastien Wilmet <swilmet gnome org>
+ *
+ * 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 "devhelp.h"
+
+static void
+test_belongs_to_page (void)
+{
+}
+
+int
+main (int    argc,
+      char **argv)
+{
+        g_test_init (&argc, &argv, NULL);
+
+        g_test_add_func ("/link/belongs_to_page", test_belongs_to_page);
+
+        return g_test_run ();
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]