From 045bc7adde0caee68698159d915fdbdd4e98860c Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 17 Mar 2023 11:03:09 +0000 Subject: [PATCH] gtestutils: Clarify docs about calling g_test_init() before anything Signed-off-by: Philip Withnall Fixes: #2943 --- glib/gtestutils.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/glib/gtestutils.c b/glib/gtestutils.c index fcf1caff3..e98294ed3 100644 --- a/glib/gtestutils.c +++ b/glib/gtestutils.c @@ -89,11 +89,15 @@ * The API is designed to handle creation and registration of test suites * and test cases implicitly. A simple call like * |[ + * g_test_init (&argc, &argv, G_TEST_OPTION_ISOLATE_DIRS, NULL); + * * g_test_add_func ("/misc/assertions", test_assertions); * ]| * creates a test suite called "misc" with a single test case named * "assertions", which consists of running the test_assertions function. * + * g_test_init() should be called before calling any other test functions. + * * In addition to the traditional g_assert_true(), the test framework provides * an extended set of assertions for comparisons: g_assert_cmpfloat(), * g_assert_cmpfloat_with_epsilon(), g_assert_cmpint(), g_assert_cmpuint(), @@ -1684,6 +1688,8 @@ test_rm_isolate_dirs (void) * test random number generator, the name for g_get_prgname() * and parsing test related command line args. * + * This should be called before calling any other `g_test_*()` functions. + * * So far, the following arguments are understood: * * - `-l`: List test cases available in a test executable.