[glib: 1/2] gtestutils: Mention G_DISABLE_ASSERT in documentation for g_test_init()



commit 17df5c0b266df0ff3cacc8c6d54fdaf6cdc5a330
Author: Philip Withnall <withnall endlessm com>
Date:   Tue Jul 31 19:49:37 2018 +0100

    gtestutils: Mention G_DISABLE_ASSERT in documentation for g_test_init()
    
    g_test_init() bails if G_DISABLE_ASSERT is defined. Mention that. This
    is a follow-up to
    https://gitlab.gnome.org/GNOME/glib/merge_requests/174.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    https://gitlab.gnome.org/GNOME/glib/issues/1446

 glib/gtestutils.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/glib/gtestutils.c b/glib/gtestutils.c
index da6c7338c..6be56049c 100644
--- a/glib/gtestutils.c
+++ b/glib/gtestutils.c
@@ -1271,6 +1271,12 @@ parse_args (gint    *argc_p,
  *
  * - `--debug-log`: Debug test logging output.
  *
+ * Since 2.58, if tests are compiled with `G_DISABLE_ASSERT` defined,
+ * g_test_init() will print an error and exit. This is to prevent no-op tests
+ * from being executed, as g_assert() is commonly (erroneously) used in unit
+ * tests, and is a no-op when compiled with `G_DISABLE_ASSERT`. Ensure your
+ * tests are compiled without `G_DISABLE_ASSERT` defined.
+ *
  * Since: 2.16
  */
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]