gtestutils: Bail out of g_test_init() if G_DISABLE_ASSERT is definedca23acdb24b568ed98257f1c462eb83ca527a205174/head
commitca23acdb24b568ed98257f1c462eb83ca527a205
authorPhilip Withnall <withnall@endlessm.com>
Wed, 11 Jul 2018 15:30:24 +0000 (11 17:30 +0200)
committerPhilip Withnall <withnall@endlessm.com>
Wed, 11 Jul 2018 15:41:46 +0000 (11 17:41 +0200)
treed5fc4bf19c4a1de2b124dfad1a2324c38345e52a
parent51ce8d204c62bdc67f7d6f5816b3192f43ac6175
gtestutils: Bail out of g_test_init() if G_DISABLE_ASSERT is defined

If G_DISABLE_ASSERT is defined, g_assert() is a no-op. Despite it now
being standard practice to *not* use g_assert() in unit tests (use
g_assert_*() instead), a lot of existing unit tests still use it.
Compiling those tests with G_DISABLE_ASSERT would make them silently
no-ops. Avoid that by warning the user loudly.

Note that it’s pretty rare for people to compile with G_DISABLE_ASSERT,
so it’s not expected that this will be hit often.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://gitlab.gnome.org/GNOME/glib/issues/976
glib/gtestutils.c
glib/gtestutils.h