Add a way to make assertions non-fatal
authorMatthias Clasen <mclasen@redhat.com>
Sat, 17 Aug 2013 19:18:29 +0000 (15:18 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 17 Aug 2013 21:25:57 +0000 (17:25 -0400)
commita6a87506877939fee54bdc7eca70d47fc7d893d4
tree88c78dd6d19de9ca1f374651bdc5bee640331eac
parentb63739e60ea03364a7a06e0c697b5c6c4690d0b6
Add a way to make assertions non-fatal

When using test harnesses other than gtester (e.g. using TAP),
it can be suboptimal to have the very first failed assertion
abort the test suite.

This commit adds a g_test_set_nonfatal_assertions() that can
be called in a test binary to change the behaviour of most
assert macros to just call g_test_fail() and continue. We
don't change the behavior of g_assert() and g_assert_not_reached(),
since these to assertion macros are older than GTest, are
widely used outside of testsuites, and will cause compiler
warnings if they loose their noreturn annotation.

https://bugzilla.gnome.org/show_bug.cgi?id=692125
glib/gtestutils.c
glib/gtestutils.h