GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
test-incompatdep.c
1 #include "config.h"
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <libguile.h>
5 #include <unittest-support.h>
6 
7 #include "gnc-module.h"
8 
9 static void
10 guile_main(void *closure, int argc, char ** argv)
11 {
12  GNCModule foo;
13  gchar *msg1 = "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
14  gchar *msg2 = "Could not locate module gnucash/incompatdep interface v.0";
15  gchar *logdomain = "gnc.module";
16  guint loglevel = G_LOG_LEVEL_WARNING;
17  TestErrorStruct check1 = { loglevel, logdomain, msg1 };
18  TestErrorStruct check2 = { loglevel, logdomain, msg2 };
19  test_add_error (&check1);
20  test_add_error (&check2);
21  g_log_set_handler (logdomain, loglevel,
22  (GLogFunc)test_list_handler, NULL);
23 
24  g_test_message(" test-incompatdep.c: loading a module with bad deps ...\n");
25 
26  gnc_module_system_init();
27 
28  foo = gnc_module_load("gnucash/incompatdep", 0);
29 
30  if (!foo)
31  {
32  printf(" ok\n");
33  exit(0);
34  }
35  else
36  {
37  printf(" oops! loaded incompatible module\n");
38  exit(-1);
39  }
40 }
41 
42 int
43 main(int argc, char ** argv)
44 {
45  scm_boot_guile(argc, argv, guile_main, NULL);
46  return 0;
47 }