1 /********************************************************************\
2  * This program is free software; you can redistribute it and/or    *
3  * modify it under the terms of the GNU General Public License as   *
4  * published by the Free Software Foundation; either version 2 of   *
5  * the License, or (at your option) any later version.              *
6  *                                                                  *
7  * This program is distributed in the hope that it will be useful,  *
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
10  * GNU General Public License for more details.                     *
11  *                                                                  *
12  * You should have received a copy of the GNU General Public License*
13  * along with this program; if not, contact:                        *
14  *                                                                  *
15  * Free Software Foundation           Voice:  +1-617-542-5942       *
16  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
17  * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
18  *                                                                  *
19 \********************************************************************/
20 
21 #include <config.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <unittest-support.h>
25 
26 #include "gnc-module.h"
27 
28 int
main(int argc,char ** argv)29 main(int argc, char ** argv)
30 {
31     GNCModule foo;
32     gchar *msg1 = "Could not locate module gnucash/ordinary interface v.25";
33     gchar *msg2 = "Initialization failed for module gnucash/incompatdep";
34 
35     g_test_message("  test-incompatdep.c:  loading a module with bad deps ...\n");
36 
37     g_test_expect_message ("gnc.module", G_LOG_LEVEL_WARNING, msg1);
38     g_test_expect_message ("gnc.module", G_LOG_LEVEL_WARNING, msg2);
39 
40     gnc_module_system_init();
41 
42     foo = gnc_module_load("gnucash/incompatdep", 0);
43 
44     g_test_assert_expected_messages();
45 
46     if (!foo)
47     {
48         printf("  ok\n");
49         exit(0);
50     }
51     else
52     {
53         printf("  oops! loaded incompatible module\n");
54         exit(-1);
55     }
56 }
57