mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
Add a function to check test status from the inside
The new g_test_failed() function can be used to find out if a currently running testcase is already marked as failed. https://bugzilla.gnome.org/show_bug.cgi?id=692125
This commit is contained in:
parent
88eaefb9d5
commit
69582bf635
@ -1631,6 +1631,30 @@ g_test_skip (const gchar *msg)
|
||||
test_run_msg = g_strdup (msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_test_failed:
|
||||
*
|
||||
* Returns whether a test has already failed. This will
|
||||
* be the case when g_test_fail(), g_test_incomplete()
|
||||
* or g_test_skip() have been called, but also if an
|
||||
* assertion has failed.
|
||||
*
|
||||
* This can be useful to return early from a test if
|
||||
* continuing after a failed assertion might be harmful.
|
||||
*
|
||||
* The return value of this function is only meaningful
|
||||
* if it is called from inside a test function.
|
||||
*
|
||||
* Returns: %TRUE if the test has failed
|
||||
*
|
||||
* Since: 2.38
|
||||
*/
|
||||
gboolean
|
||||
g_test_failed (void)
|
||||
{
|
||||
return test_run_success != G_TEST_RUN_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* GTestFunc:
|
||||
*
|
||||
|
@ -133,6 +133,8 @@ GLIB_AVAILABLE_IN_2_38
|
||||
void g_test_incomplete (const gchar *msg);
|
||||
GLIB_AVAILABLE_IN_2_38
|
||||
void g_test_skip (const gchar *msg);
|
||||
GLIB_AVAILABLE_IN_2_38
|
||||
gboolean g_test_failed (void);
|
||||
|
||||
/* hook up a test with fixture under test path */
|
||||
#define g_test_add(testpath, Fixture, tdata, fsetup, ftest, fteardown) \
|
||||
|
Loading…
Reference in New Issue
Block a user