mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-09 12:25:48 +01:00
gtestutils: add g_assert_nonnull() to go with g_assert_null()
https://bugzilla.gnome.org/show_bug.cgi?id=711800
This commit is contained in:
parent
f4c30feb95
commit
97fac93670
@ -2977,6 +2977,7 @@ g_assert_error
|
|||||||
g_assert_true
|
g_assert_true
|
||||||
g_assert_false
|
g_assert_false
|
||||||
g_assert_null
|
g_assert_null
|
||||||
|
g_assert_nonnull
|
||||||
g_test_set_nonfatal_assertions
|
g_test_set_nonfatal_assertions
|
||||||
|
|
||||||
GTestCase
|
GTestCase
|
||||||
|
@ -391,6 +391,21 @@
|
|||||||
* Since: 2.38
|
* Since: 2.38
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_assert_nonnull:
|
||||||
|
* @expr: the expression to check
|
||||||
|
*
|
||||||
|
* Debugging macro to check an expression is not %NULL.
|
||||||
|
*
|
||||||
|
* If the assertion fails (i.e. the expression is %NULL),
|
||||||
|
* an error message is logged and the application is either
|
||||||
|
* terminated or the testcase marked as failed.
|
||||||
|
*
|
||||||
|
* See g_test_set_nonfatal_assertions().
|
||||||
|
*
|
||||||
|
* Since: 2.40
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_assert_cmpstr:
|
* g_assert_cmpstr:
|
||||||
* @s1: a string (may be %NULL)
|
* @s1: a string (may be %NULL)
|
||||||
|
@ -74,7 +74,11 @@ typedef void (*GTestFixtureFunc) (gpointer fixture,
|
|||||||
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
|
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
|
||||||
#expr); \
|
#expr); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define g_assert_null(expr) do { if G_LIKELY ((expr) == NULL) ; else \
|
#define g_assert_null(expr) do { if G_LIKELY ((expr) == NULL) ; else \
|
||||||
|
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
|
||||||
|
#expr); \
|
||||||
|
} while (0)
|
||||||
|
#define g_assert_nonnull(expr) do { if G_LIKELY ((expr) != NULL) ; else \
|
||||||
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
|
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
|
||||||
#expr); \
|
#expr); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user