diff options
author | Dan Winship <danw@gnome.org> | 2014-02-14 16:12:50 -0500 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-02-17 11:33:37 -0500 |
commit | 5a4478664be8bc6523f6452bfd63340718be2aa5 (patch) | |
tree | c87af78e6be7cc66ce6997ed0abdaad03358c659 /glib/gtestutils.h | |
parent | 299ca6dc1e54797e6fc5264c7b19b08bd726ca83 (diff) | |
download | glib-5a4478664be8bc6523f6452bfd63340718be2aa5.tar.gz |
gtestutils: make the new assert messages more detailed
g_assert_true(), g_assert_false(), g_assert_null(), and
g_assert_nonnull() simply printed out the expression they were
checking, without any further explanation of what went wrong. (In
particular, "g_assert_true(x)" and "g_assert_false(x)" would both
print the same thing on failure.) Add a little bit more context.
https://bugzilla.gnome.org/show_bug.cgi?id=724385
Diffstat (limited to 'glib/gtestutils.h')
-rw-r--r-- | glib/gtestutils.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/glib/gtestutils.h b/glib/gtestutils.h index d6b3e5276..49986d228 100644 --- a/glib/gtestutils.h +++ b/glib/gtestutils.h @@ -66,19 +66,19 @@ typedef void (*GTestFixtureFunc) (gpointer fixture, #err, err, dom, c); } while (0) #define g_assert_true(expr) do { if G_LIKELY (expr) ; else \ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #expr); \ + "'" #expr "' should be TRUE"); \ } while (0) #define g_assert_false(expr) do { if G_LIKELY (!(expr)) ; else \ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #expr); \ + "'" #expr "' should be FALSE"); \ } while (0) #define g_assert_null(expr) do { if G_LIKELY ((expr) == NULL) ; else \ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #expr); \ + "'" #expr "' should be NULL"); \ } while (0) #define g_assert_nonnull(expr) do { if G_LIKELY ((expr) != NULL) ; else \ g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ - #expr); \ + "'" #expr "' should not be NULL"); \ } while (0) #ifdef G_DISABLE_ASSERT #define g_assert_not_reached() do { (void) 0; } while (0) |