mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-27 18:10:03 +01:00
glib/gtestutils: Introduce and use a test_cleanup function
This commit is contained in:
parent
353f0b5235
commit
bd779c96e9
@ -832,6 +832,7 @@ struct DestroyEntry
|
||||
};
|
||||
|
||||
/* --- prototypes --- */
|
||||
static void test_cleanup (void);
|
||||
static void test_run_seed (const gchar *rseed);
|
||||
static void test_trap_clear (void);
|
||||
static guint8* g_test_log_dump (GTestLogMsg *msg,
|
||||
@ -1726,6 +1727,18 @@ void
|
||||
test_built_files_dir = test_argv0_dirname;
|
||||
}
|
||||
|
||||
static void
|
||||
test_cleanup (void)
|
||||
{
|
||||
/* Free statically allocated variables */
|
||||
|
||||
g_clear_pointer (&test_run_rand, g_rand_free);
|
||||
|
||||
g_clear_pointer (&test_argv0_dirname, g_free);
|
||||
|
||||
g_clear_pointer (&test_initial_cwd, g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
test_run_seed (const gchar *rseed)
|
||||
{
|
||||
@ -2217,6 +2230,7 @@ g_test_run (void)
|
||||
|
||||
out:
|
||||
g_test_suite_free (suite);
|
||||
test_cleanup ();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user