mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-11-05 19:03:31 +00:00
shared/tests: add nmtst_assert_nonnull() macro
There is g_assert_nonnull(), however that doesn't return the pointer. Returning the pointer can be convenient...
This commit is contained in:
parent
bd8ab54b8e
commit
770015f512
1 changed files with 8 additions and 0 deletions
|
@ -162,6 +162,14 @@
|
|||
g_assert_not_reached (); \
|
||||
} G_STMT_END
|
||||
|
||||
#define nmtst_assert_nonnull(command) \
|
||||
({ \
|
||||
typeof (*(command)) *_ptr = (command); \
|
||||
\
|
||||
g_assert (_ptr && (TRUE || (command))); \
|
||||
_ptr; \
|
||||
})
|
||||
|
||||
#define nmtst_assert_success(success, error) \
|
||||
G_STMT_START { \
|
||||
g_assert_no_error (error); \
|
||||
|
|
Loading…
Reference in a new issue