[glib: 7/11] tests: Use g_assert_*() in closure-refcount, rather than g_assert()



commit 85c02df04eaf58049e1023dce69fbd93a338469a
Author: Philip Withnall <withnall endlessm com>
Date:   Wed Feb 27 11:55:36 2019 +0000

    tests: Use g_assert_*() in closure-refcount, rather than g_assert()
    
    g_assert() can be compiled out if G_DISABLE_ASSERT is defined; and
    g_assert_*() provide more specific error messages on failure.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 gobject/tests/closure-refcount.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/gobject/tests/closure-refcount.c b/gobject/tests/closure-refcount.c
index 64a8a1dec..fb0b92a06 100644
--- a/gobject/tests/closure-refcount.c
+++ b/gobject/tests/closure-refcount.c
@@ -215,8 +215,8 @@ test_signal_handler (GTest   *test,
                      gint     vint,
                      gpointer data)
 {
-  g_assert (data == TEST_POINTER2);
-  g_assert (test->test_pointer1 == TEST_POINTER1);
+  g_assert_true (data == TEST_POINTER2);
+  g_assert_true (test->test_pointer1 == TEST_POINTER1);
   seen_signal_handler = TRUE;
   seen_test_int1 |= vint == TEST_INT1;
   seen_test_int2 |= vint == TEST_INT2;
@@ -227,7 +227,7 @@ destroy_data (gpointer  data,
               GClosure *closure)
 {
   seen_cleanup = data == TEST_POINTER2;
-  g_assert (closure->ref_count == 0);
+  g_assert_cmpint (closure->ref_count, ==, 0);
 }
 
 static void
@@ -294,12 +294,12 @@ test_closure_refcount (void)
 
   g_test_message ("Stopped");
 
-  g_assert (seen_thread1 != FALSE);
-  g_assert (seen_thread2 != FALSE);
-  g_assert (seen_test_int1 != FALSE);
-  g_assert (seen_test_int2 != FALSE);
-  g_assert (seen_signal_handler != FALSE);
-  g_assert (seen_cleanup != FALSE);
+  g_assert_true (seen_thread1);
+  g_assert_true (seen_thread2);
+  g_assert_true (seen_test_int1);
+  g_assert_true (seen_test_int2);
+  g_assert_true (seen_signal_handler);
+  g_assert_true (seen_cleanup);
 }
 
 int


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