Mercurial > pidgin
comparison libpurple/tests/check_libpurple.c @ 15805:a0a5e323a6ac
libpurplify the 'make check' tests so they work again
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sat, 17 Mar 2007 17:29:40 +0000 |
parents | |
children | 32c366eeeb99 |
comparison
equal
deleted
inserted
replaced
15804:87997f44e75e | 15805:a0a5e323a6ac |
---|---|
1 #include <glib.h> | |
2 #include <stdlib.h> | |
3 | |
4 #include "../core.h" | |
5 #include "../eventloop.h" | |
6 | |
7 #include "tests.h" | |
8 | |
9 /****************************************************************************** | |
10 * libpurple goodies | |
11 *****************************************************************************/ | |
12 static guint | |
13 gaim_check_input_add(gint fd, GaimInputCondition condition, | |
14 GaimInputFunction function, gpointer data) | |
15 { | |
16 /* this is a no-op for now, feel free to implement it */ | |
17 return 0; | |
18 } | |
19 | |
20 static GaimEventLoopUiOps eventloop_ui_ops = { | |
21 g_timeout_add, | |
22 (guint (*)(guint))g_source_remove, | |
23 gaim_check_input_add, | |
24 (guint (*)(guint))g_source_remove, | |
25 }; | |
26 | |
27 static void | |
28 gaim_check_init(void) { | |
29 gchar *home_dir; | |
30 | |
31 gaim_eventloop_set_ui_ops(&eventloop_ui_ops); | |
32 | |
33 /* build our fake home directory */ | |
34 home_dir = g_build_path(BUILDDIR, "libpurple", "tests", "home", NULL); | |
35 gaim_util_set_user_dir(home_dir); | |
36 g_free(home_dir); | |
37 | |
38 gaim_core_init("check"); | |
39 } | |
40 | |
41 /****************************************************************************** | |
42 * Check meat and potatoes | |
43 *****************************************************************************/ | |
44 Suite* | |
45 master_suite(void) | |
46 { | |
47 Suite *s = suite_create("Master Suite"); | |
48 | |
49 return s; | |
50 } | |
51 | |
52 int main(void) | |
53 { | |
54 int number_failed; | |
55 SRunner *sr = srunner_create (master_suite()); | |
56 | |
57 srunner_add_suite(sr, cipher_suite()); | |
58 srunner_add_suite(sr, jabber_jutil_suite()); | |
59 srunner_add_suite(sr, util_suite()); | |
60 | |
61 /* make this a libpurple "ui" */ | |
62 gaim_check_init(); | |
63 | |
64 srunner_run_all (sr, CK_NORMAL); | |
65 number_failed = srunner_ntests_failed (sr); | |
66 srunner_free (sr); | |
67 | |
68 gaim_core_quit(); | |
69 | |
70 return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; | |
71 } |