aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore2
-rw-r--r--tests/Makefile.am25
-rw-r--r--tests/check-empathy-utils.c29
-rw-r--r--tests/check-libempathy.h1
-rw-r--r--tests/check-main.c1
-rw-r--r--tests/empathy-utils-test.c48
6 files changed, 72 insertions, 34 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index 28aa99b06..4e0f3c1f6 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,2 +1,4 @@
check-main
*.log
+empathy-utils-test
+test-report.xml
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a93b6fd8a..21ee99bf8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -23,14 +23,19 @@ LDADD = \
$(top_builddir)/libempathy/libempathy.la \
$(EMPATHY_LIBS)
-check_PROGRAMS = check-main
+TEST_PROGS = \
+ empathy-utils-test
+
+empathy_utils_test_SOURCES = empathy-utils-test.c
+
+check_PROGRAMS = check-main $(TEST_PROGS)
+
TESTS = check-main
check_main_SOURCES = \
check-main.c \
check-helpers.c \
check-helpers.h \
check-libempathy.h \
- check-empathy-utils.c \
check-empathy-helpers.h \
check-empathy-helpers.c \
check-irc-helper.h \
@@ -44,7 +49,7 @@ check_main_SOURCES = \
check_c_sources = \
$(check_main_SOURCES)
include $(top_srcdir)/tools/check-coding-style.mk
-check-local: check-coding-style
+check-local: test check-coding-style
check_main_LDADD = \
@CHECK_LIBS@ \
@@ -59,3 +64,17 @@ check_main_CFLAGS = \
TESTS_ENVIRONMENT = EMPATHY_SRCDIR=@abs_top_srcdir@ \
MC_PROFILE_DIR=@abs_top_srcdir@/tests \
MC_MANAGER_DIR=@abs_top_srcdir@/tests
+
+test-report: test-report.xml
+ gtester-report $(top_builddir)/tests/$@.xml > \
+ $(top_builddir)/tests/$@.html
+
+test-report.xml: ${TEST_PROGS} test
+
+test: ${TEST_PROGS}
+ gtester -o test-report.xml -k --verbose ${TEST_PROGS}
+
+test-%: empathy-%-test
+ gtester -o $@-report.xml -k --verbose $<
+
+.PHONY: test test-report
diff --git a/tests/check-empathy-utils.c b/tests/check-empathy-utils.c
deleted file mode 100644
index faf261058..000000000
--- a/tests/check-empathy-utils.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <check.h>
-#include "check-helpers.h"
-#include "check-libempathy.h"
-
-#include <libempathy/empathy-utils.h>
-
-START_TEST (test_empathy_substring)
-{
- gchar *tmp;
-
- tmp = empathy_substring ("empathy", 2, 6);
- fail_if (tmp == NULL);
- fail_if (strcmp (tmp, "path") != 0);
-
- g_free (tmp);
-}
-END_TEST
-
-TCase *
-make_empathy_utils_tcase (void)
-{
- TCase *tc = tcase_create ("empathy-utils");
- tcase_add_test (tc, test_empathy_substring);
- return tc;
-}
diff --git a/tests/check-libempathy.h b/tests/check-libempathy.h
index 5dcb2b17a..35da2a14d 100644
--- a/tests/check-libempathy.h
+++ b/tests/check-libempathy.h
@@ -1,7 +1,6 @@
#ifndef __CHECK_LIBEMPATHY__
#define __CHECK_LIBEMPATHY__
-TCase * make_empathy_utils_tcase (void);
TCase * make_empathy_irc_server_tcase (void);
TCase * make_empathy_irc_network_tcase (void);
TCase * make_empathy_irc_network_manager_tcase (void);
diff --git a/tests/check-main.c b/tests/check-main.c
index 7adbc15df..f5cd50a95 100644
--- a/tests/check-main.c
+++ b/tests/check-main.c
@@ -16,7 +16,6 @@ make_libempathy_suite (void)
{
Suite *s = suite_create ("libempathy");
- suite_add_tcase (s, make_empathy_utils_tcase ());
suite_add_tcase (s, make_empathy_irc_server_tcase ());
suite_add_tcase (s, make_empathy_irc_network_tcase ());
suite_add_tcase (s, make_empathy_irc_network_manager_tcase ());
diff --git a/tests/empathy-utils-test.c b/tests/empathy-utils-test.c
new file mode 100644
index 000000000..415526ff3
--- /dev/null
+++ b/tests/empathy-utils-test.c
@@ -0,0 +1,48 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <glib.h>
+
+#include <libempathy/empathy-utils.h>
+
+static void
+test_init (int argc,
+ char **argv)
+{
+ g_test_init (&argc, &argv, NULL);
+ g_type_init ();
+}
+
+static void
+test_deinit (void)
+{
+ ;
+}
+
+static void
+test_substring (void)
+{
+ gchar *tmp;
+
+ tmp = empathy_substring ("empathy", 2, 6);
+ g_assert (tmp != NULL);
+ g_assert (strcmp (tmp, "path") == 0);
+
+ g_free (tmp);
+}
+
+int
+main (int argc,
+ char **argv)
+{
+ int result;
+
+ test_init (argc, argv);
+
+ g_test_add_func ("/utils/substring", test_substring);
+
+ result = g_test_run ();
+ test_deinit ();
+ return result;
+}