GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
test-modsysver.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/futuremodsys 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-modsysver.c: checking for a module we shouldn't find ...\n");
25 
26  gnc_module_system_init();
27 
28  foo = gnc_module_load("gnucash/futuremodsys", 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  test_clear_error_list ();
41 }
42 
43 int
44 main(int argc, char ** argv)
45 {
46  scm_boot_guile(argc, argv, guile_main, NULL);
47  return 0;
48 }