summaryrefslogtreecommitdiff
path: root/gir/glib-2.0.c
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2018-07-20 09:08:58 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2018-07-20 09:08:58 +0200
commite82f2462fe1cb5cbdd154b691164a33f5c08b7d0 (patch)
tree050bd9dc50051a0a472df5309967c0f03f297cd6 /gir/glib-2.0.c
parentd2d3450a403500d2c1c355685bc0a2678af5bd6b (diff)
downloadgobject-introspection-e82f2462fe1cb5cbdd154b691164a33f5c08b7d0.tar.gz
gir: Update annotations to glib 2.57.2
Diffstat (limited to 'gir/glib-2.0.c')
-rw-r--r--gir/glib-2.0.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/gir/glib-2.0.c b/gir/glib-2.0.c
index 09eb0da0..9c14eec7 100644
--- a/gir/glib-2.0.c
+++ b/gir/glib-2.0.c
@@ -8440,14 +8440,18 @@
* creates a test suite called "misc" with a single test case named
* "assertions", which consists of running the test_assertions function.
*
- * In addition to the traditional g_assert(), the test framework provides
+ * In addition to the traditional g_assert_true(), the test framework provides
* an extended set of assertions for comparisons: g_assert_cmpfloat(),
* g_assert_cmpfloat_with_epsilon(), g_assert_cmpint(), g_assert_cmpuint(),
* g_assert_cmphex(), g_assert_cmpstr(), and g_assert_cmpmem(). The
- * advantage of these variants over plain g_assert() is that the assertion
+ * advantage of these variants over plain g_assert_true() is that the assertion
* messages can be more elaborate, and include the values of the compared
* entities.
*
+ * Note that g_assert() should not be used in unit tests, since it is a no-op
+ * when compiling with `G_DISABLE_ASSERT`. Use g_assert() in production code,
+ * and g_assert_true() in unit tests.
+ *
* A full example of creating a test suite with two tests using fixtures:
* |[<!-- language="C" -->
* #include <glib.h>
@@ -9946,7 +9950,10 @@
*
* The macro can be turned off in final releases of code by defining
* `G_DISABLE_ASSERT` when compiling the application, so code must
- * not depend on any side effects from @expr.
+ * not depend on any side effects from @expr. Similarly, it must not be used
+ * in unit tests, otherwise the unit tests will be ineffective if compiled with
+ * `G_DISABLE_ASSERT`. Use g_assert_true() and related macros in unit tests
+ * instead.
*/
@@ -10120,6 +10127,10 @@
* an error message is logged and the application is either
* terminated or the testcase marked as failed.
*
+ * Note that unlike g_assert(), this macro is unaffected by whether
+ * `G_DISABLE_ASSERT` is defined. Hence it should only be used in tests and,
+ * conversely, g_assert() should not be used in tests.
+ *
* See g_test_set_nonfatal_assertions().
*
* Since: 2.38
@@ -10151,6 +10162,10 @@
* an error message is logged and the application is either
* terminated or the testcase marked as failed.
*
+ * Note that unlike g_assert(), this macro is unaffected by whether
+ * `G_DISABLE_ASSERT` is defined. Hence it should only be used in tests and,
+ * conversely, g_assert() should not be used in tests.
+ *
* See g_test_set_nonfatal_assertions().
*
* Since: 2.40
@@ -10165,7 +10180,8 @@
* application is terminated.
*
* The macro can be turned off in final releases of code by defining
- * `G_DISABLE_ASSERT` when compiling the application.
+ * `G_DISABLE_ASSERT` when compiling the application. Hence, it should not be
+ * used in unit tests, where assertions should always be effective.
*/
@@ -10179,6 +10195,10 @@
* an error message is logged and the application is either
* terminated or the testcase marked as failed.
*
+ * Note that unlike g_assert(), this macro is unaffected by whether
+ * `G_DISABLE_ASSERT` is defined. Hence it should only be used in tests and,
+ * conversely, g_assert() should not be used in tests.
+ *
* See g_test_set_nonfatal_assertions().
*
* Since: 2.38
@@ -10195,6 +10215,10 @@
* an error message is logged and the application is either
* terminated or the testcase marked as failed.
*
+ * Note that unlike g_assert(), this macro is unaffected by whether
+ * `G_DISABLE_ASSERT` is defined. Hence it should only be used in tests and,
+ * conversely, g_assert() should not be used in tests.
+ *
* See g_test_set_nonfatal_assertions().
*
* Since: 2.38