GnuCash 2.4.99
test-incompatdep.c
00001 #include "config.h"
00002 #include <stdio.h>
00003 #include <stdlib.h>
00004 #include <libguile.h>
00005 #include <unittest-support.h>
00006 
00007 #include "gnc-module.h"
00008 
00009 static void
00010 guile_main(void *closure, int argc, char ** argv)
00011 {
00012     GNCModule foo;
00013     gchar *msg1 = "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
00014     gchar *msg2 = "Could not locate module gnucash/incompatdep interface v.0";
00015     gchar *logdomain = "gnc.module";
00016     guint loglevel = G_LOG_LEVEL_WARNING;
00017     TestErrorStruct check1 = { loglevel, logdomain, msg1 };
00018     TestErrorStruct check2 = { loglevel, logdomain, msg2 };
00019     test_add_error (&check1);
00020     test_add_error (&check2);
00021     g_log_set_handler (logdomain, loglevel,
00022                        (GLogFunc)test_list_handler, NULL);
00023 
00024     g_test_message("  test-incompatdep.c:  loading a module with bad deps ...\n");
00025 
00026     gnc_module_system_init();
00027 
00028     foo = gnc_module_load("gnucash/incompatdep", 0);
00029 
00030     if (!foo)
00031     {
00032         printf("  ok\n");
00033         exit(0);
00034     }
00035     else
00036     {
00037         printf("  oops! loaded incompatible module\n");
00038         exit(-1);
00039     }
00040 }
00041 
00042 int
00043 main(int argc, char ** argv)
00044 {
00045     scm_boot_guile(argc, argv, guile_main, NULL);
00046     return 0;
00047 }
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines