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:
Thomas Haller 2018-04-05 19:02:18 +02:00
parent bd8ab54b8e
commit 770015f512

View file

@ -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); \