# HG changeset patch # User ali # Date 1380003530 -3600 # Node ID 8c2d6a0cf7172aba353cc2bb1bd7fd37c966b663 # Parent d13e2582c2b56ad22114b922777c744a28931110 Fix bug #10: loupe-test should have an option to display bookloupe output diff -r d13e2582c2b5 -r 8c2d6a0cf717 test/harness/loupe-test.c --- a/test/harness/loupe-test.c Tue Sep 24 06:44:58 2013 +0100 +++ b/test/harness/loupe-test.c Tue Sep 24 07:18:50 2013 +0100 @@ -6,6 +6,14 @@ #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). @@ -17,7 +25,10 @@ testcase=testcase_parse_file(filename); if (!testcase) return FALSE; - retval=testcase_run(testcase); + if (show_output) + retval=testcase_show_output(testcase); + else + retval=testcase_run(testcase); testcase_free(testcase); return retval; } @@ -26,6 +37,16 @@ { 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(); for(i=1;imessage); + g_error_free(error); + } + return r; +} + +/* * Free a testcase warning. */ void testcase_warning_free(TestcaseWarning *warning) diff -r d13e2582c2b5 -r 8c2d6a0cf717 test/harness/testcase.h --- a/test/harness/testcase.h Tue Sep 24 06:44:58 2013 +0100 +++ b/test/harness/testcase.h Tue Sep 24 07:18:50 2013 +0100 @@ -49,6 +49,7 @@ GQuark testcase_error_quark(void); gboolean testcase_run(Testcase *testcase); +gboolean testcase_show_output(Testcase *testcase); void testcase_free(Testcase *testcase); #endif /* TESTCASE_H */