aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile2
-rw-r--r--tests/check.c4
-rw-r--r--tests/check_help.c30
3 files changed, 35 insertions, 1 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 9dd3df7c..3ddd1570 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -10,7 +10,7 @@ clean:
main_objs = account.o bitlbee.o conf.o crypting.o help.o ipc.o irc.o irc_commands.o log.o nick.o query.o root_commands.o set.o storage.o storage_xml.o storage_text.o user.o
-test_objs = check.o check_util.o check_nick.o check_md5.o check_irc.o
+test_objs = check.o check_util.o check_nick.o check_md5.o check_irc.o check_help.o
check: $(test_objs) $(addprefix ../, $(main_objs)) ../protocols/protocols.o ../lib/lib.o
@echo '*' Linking $@
diff --git a/tests/check.c b/tests/check.c
index f70ccae7..069b3c57 100644
--- a/tests/check.c
+++ b/tests/check.c
@@ -40,6 +40,9 @@ Suite *md5_suite(void);
/* From check_irc.c */
Suite *irc_suite(void);
+/* From check_help.c */
+Suite *help_suite(void);
+
int main (int argc, char **argv)
{
int nf;
@@ -80,6 +83,7 @@ int main (int argc, char **argv)
srunner_add_suite(sr, nick_suite());
srunner_add_suite(sr, md5_suite());
srunner_add_suite(sr, irc_suite());
+ srunner_add_suite(sr, help_suite());
if (no_fork)
srunner_set_fork_status(sr, CK_NOFORK);
srunner_run_all (sr, verbose?CK_VERBOSE:CK_NORMAL);
diff --git a/tests/check_help.c b/tests/check_help.c
new file mode 100644
index 00000000..7e5283e3
--- /dev/null
+++ b/tests/check_help.c
@@ -0,0 +1,30 @@
+#include <stdlib.h>
+#include <glib.h>
+#include <gmodule.h>
+#include <check.h>
+#include <string.h>
+#include <stdio.h>
+#include "help.h"
+
+START_TEST(test_help_none)
+ help_t *h, *r;
+ r = help_init(&h, "/dev/null");
+ fail_if(r == NULL);
+ fail_if(r != h);
+END_TEST
+
+START_TEST(test_help_nonexistent)
+ help_t *h, *r;
+ r = help_init(&h, "/dev/null");
+ fail_unless(help_get(&h, "nonexistent") == NULL);
+END_TEST
+
+Suite *help_suite (void)
+{
+ Suite *s = suite_create("Help");
+ TCase *tc_core = tcase_create("Core");
+ suite_add_tcase (s, tc_core);
+ tcase_add_test (tc_core, test_help_none);
+ tcase_add_test (tc_core, test_help_nonexistent);
+ return s;
+}