#include #include #include #include #include #include "testcase.h" #include "testcaseio.h" static gboolean show_output; static GOptionEntry options[]={ { "show-output", 'o', 0, G_OPTION_ARG_NONE, &show_output, "Show bookloupe output", NULL }, { NULL } }; /* * Returns FALSE if the test should be considered to have failed. * (returns TRUE on pass or expected-fail). */ gboolean run_test(const char *filename) { Testcase *testcase; gboolean retval; testcase=testcase_parse_file(filename); if (!testcase) return FALSE; if (show_output) retval=testcase_show_output(testcase); else retval=testcase_run(testcase); testcase_free(testcase); return retval; } int main(int argc,char **argv) { int i; gboolean pass=TRUE; GError *err=NULL; GOptionContext *context; context=g_option_context_new("file - run a bookloupe testcase"); g_option_context_add_main_entries(context,options,NULL); if (!g_option_context_parse(context,&argc,&argv,&err)) { g_printerr("loupe-test: %s\n",err->message); g_printerr("Use \"%s --help\" for help\n",argv[0]); exit(1); } bl_set_print_handlers(); g_setenv("BOOKLOUPE_CONFIG_PATH",".",TRUE); for(i=1;i