[glib: 2/3] tests: Use g_assert_*() rather than g_assert() in unix-streams




commit be9e268c6a554317e11f238671d25dde335ca4de
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon Oct 17 13:03:26 2022 +0100

    tests: Use g_assert_*() rather than g_assert() in unix-streams
    
    It won’t get compiled out with `G_DISABLE_ASSERT`.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 gio/tests/unix-streams.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/gio/tests/unix-streams.c b/gio/tests/unix-streams.c
index 6246e583ea..1fa66c354c 100644
--- a/gio/tests/unix-streams.c
+++ b/gio/tests/unix-streams.c
@@ -62,7 +62,7 @@ writer_thread (gpointer user_data)
          offset += nwrote;
        }
 
-      g_assert (nwrote > 0 || err != NULL);
+      g_assert_true (nwrote > 0 || err != NULL);
     }
   while (err == NULL);
 
@@ -105,14 +105,14 @@ reader_thread (gpointer user_data)
 
       if (nread == 0)
        {
-         g_assert (err == NULL);
+         g_assert_no_error (err);
          /* pipe closed */
          g_object_unref (in);
          return NULL;
        }
 
       g_assert_cmpstr (buf, ==, DATA);
-      g_assert (!g_cancellable_is_cancelled (reader_cancel));
+      g_assert_false (g_cancellable_is_cancelled (reader_cancel));
     }
   while (err == NULL);
 
@@ -271,7 +271,7 @@ test_pipe_io (gconstpointer nonblocking)
    * read op to fail.
    */
 
-  g_assert (pipe (writer_pipe) == 0 && pipe (reader_pipe) == 0);
+  g_assert_true (pipe (writer_pipe) == 0 && pipe (reader_pipe) == 0);
 
   if (nonblocking)
     {
@@ -331,13 +331,13 @@ test_basic (void)
                 "close-fd", &close_fd,
                 NULL);
   g_assert_cmpint (fd, ==, 0);
-  g_assert (close_fd);
+  g_assert_true (close_fd);
 
   g_unix_input_stream_set_close_fd (is, FALSE);
-  g_assert (!g_unix_input_stream_get_close_fd (is));
+  g_assert_false (g_unix_input_stream_get_close_fd (is));
   g_assert_cmpint (g_unix_input_stream_get_fd (is), ==, 0);
 
-  g_assert (!g_input_stream_has_pending (G_INPUT_STREAM (is)));
+  g_assert_false (g_input_stream_has_pending (G_INPUT_STREAM (is)));
 
   g_object_unref (is);
 
@@ -347,13 +347,13 @@ test_basic (void)
                 "close-fd", &close_fd,
                 NULL);
   g_assert_cmpint (fd, ==, 1);
-  g_assert (close_fd);
+  g_assert_true (close_fd);
 
   g_unix_output_stream_set_close_fd (os, FALSE);
-  g_assert (!g_unix_output_stream_get_close_fd (os));
+  g_assert_false (g_unix_output_stream_get_close_fd (os));
   g_assert_cmpint (g_unix_output_stream_get_fd (os), ==, 1);
 
-  g_assert (!g_output_stream_has_pending (G_OUTPUT_STREAM (os)));
+  g_assert_false (g_output_stream_has_pending (G_OUTPUT_STREAM (os)));
 
   g_object_unref (os);
 }


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