From f5177dbf7a06d691957f4aa506e0d7061ca3eec2 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 13 Jun 2015 21:53:49 +0200 Subject: [PATCH] test: add nmtst_assert_success() util --- include/nm-test-utils.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/nm-test-utils.h b/include/nm-test-utils.h index 75485d3766..a2948b6aa1 100644 --- a/include/nm-test-utils.h +++ b/include/nm-test-utils.h @@ -137,6 +137,14 @@ nmtst_assert_error (GError *error, } \ } G_STMT_END +inline static void +_nmtst_assert_success (gboolean success, GError *error, const char *file, int line) +{ + if (!success || error) + g_error ("(%s:%d) FAILURE success=%d, error=%s", file, line, success, error && error->message ? error->message : "(no error)"); +} +#define nmtst_assert_success(success, error) _nmtst_assert_success ((success), (error), __FILE__, __LINE__) + /*******************************************************************************/ struct __nmtst_internal