summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-06-06 18:09:40 +0200
committerThomas Haller <thaller@redhat.com>2016-06-09 12:03:39 +0200
commitfa973afa192a2b4e8566864bb9ceb5ff1d9b287f (patch)
treecfdfd7fde4cb0b48ebc392e429172fa1cc38dba1 /shared
parent21bdb8255596ef9184300604e0e28aeb92792adc (diff)
downloadNetworkManager-fa973afa192a2b4e8566864bb9ceb5ff1d9b287f.tar.gz
tests: add macro NMTST_G_RETURN_MSG for expecting g_return*() failures
A failure to g_return*() by default prints a g_critical() with stringifing the condition. Add a macro NMTST_G_RETURN_MSG() that reproduces that line to more accurately match the failure message.
Diffstat (limited to 'shared')
-rw-r--r--shared/nm-test-utils.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/shared/nm-test-utils.h b/shared/nm-test-utils.h
index ad3cad650f..471bf73d81 100644
--- a/shared/nm-test-utils.h
+++ b/shared/nm-test-utils.h
@@ -103,6 +103,11 @@
/*******************************************************************************/
+#define NMTST_G_RETURN_MSG_S(expr) "*: assertion '"expr"' failed"
+#define NMTST_G_RETURN_MSG(expr) NMTST_G_RETURN_MSG_S(#expr)
+
+/*******************************************************************************/
+
/* general purpose functions that have no dependency on other nmtst functions */
#define nmtst_assert_error(error, expect_error_domain, expect_error_code, expect_error_pattern) \