Feature request: option handling in g_test_init() should be composable
Submitted by Benjamin Kaufmann
Link to original bug (#794258)
Description
Created attachment 369572 Implementation of suggested change
Test binaries sometimes need to provide their own options in addition
to the options understood by g_test_init(). Given that g_test_init() does not (and probably cannot) use the GOption machinery, it is currently hard to compose.
Most importantly, this concerns the automatic handling of the --help
option.
To simplify option handling, I suggest the following changes (see attached patch for a possible implementation):
-
Add support for new special option "no_g_print_help" to g_test_init() for disabling automatic handling of
--help
. -
Add new API g_test_help() for querying whether g_test_init() was called with option
--help
and g_test_get_help() for getting a help text.
In addition, it is sometimes very helpful to know whether g_test_init() was
called with option -l
. To this end, I suggest adding g_test_list() to
the testing framework config.
Patch 369572, "Implementation of suggested change":
0001-gtestutils-Make-option-handling-easier-composable.patch