glib/gtestutils: Introduce and use a g_test_suite_free function

This commit is contained in:
GOUJON Évan 2021-07-23 22:16:44 +02:00
parent f0c0d8b67c
commit 353f0b5235
3 changed files with 25 additions and 0 deletions

View File

@ -3639,6 +3639,7 @@ g_test_suite_add
g_test_suite_add_suite
g_test_run_suite
g_test_case_free
g_test_suite_free
<SUBSECTION Private>
g_test_trap_assertions

View File

@ -2216,6 +2216,7 @@ g_test_run (void)
}
out:
g_test_suite_free (suite);
return ret;
}
@ -3009,6 +3010,26 @@ g_test_case_free (GTestCase *test_case)
g_slice_free (GTestCase, test_case);
}
/**
* g_test_suite_free:
* @suite: a #GTestSuite
*
* Free the @suite and all nested #GTestSuites.
*
* Since: 2.70
*/
void
g_test_suite_free (GTestSuite *suite)
{
g_slist_free_full (suite->cases, (GDestroyNotify)g_test_case_free);
g_free (suite->name);
g_slist_free_full (suite->suites, (GDestroyNotify)g_test_suite_free);
g_slice_free (GTestSuite, suite);
}
static void
gtest_default_log_handler (const gchar *log_domain,
GLogLevelFlags log_level,

View File

@ -509,6 +509,9 @@ int g_test_run_suite (GTestSuite *suite);
GLIB_AVAILABLE_IN_2_70
void g_test_case_free (GTestCase *test_case);
GLIB_AVAILABLE_IN_2_70
void g_test_suite_free (GTestSuite *suite);
GLIB_AVAILABLE_IN_ALL
void g_test_trap_assertions (const char *domain,
const char *file,