[glib/wip/test-fail-convenience: 7/9] tests: Make use of g_test_fail_message()




commit e43c83bc412edec5f61ff51f382c80d9fef36432
Author: Simon McVittie <smcv collabora com>
Date:   Thu Aug 5 11:45:11 2021 +0100

    tests: Make use of g_test_fail_message()
    
    Signed-off-by: Simon McVittie <smcv collabora com>

 gio/tests/desktop-app-info.c | 3 +--
 glib/tests/logging.c         | 6 ++----
 2 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/gio/tests/desktop-app-info.c b/gio/tests/desktop-app-info.c
index fcc29c579..b23d5a317 100644
--- a/gio/tests/desktop-app-info.c
+++ b/gio/tests/desktop-app-info.c
@@ -482,8 +482,7 @@ assert_strings_equivalent (const gchar *expected,
         if (g_str_equal (expected_words[i], result_words[j]))
           goto got_it;
 
-      g_test_message ("Unable to find expected string '%s' in result '%s'", expected_words[i], result);
-      g_test_fail ();
+      g_test_fail_message ("Unable to find expected string '%s' in result '%s'", expected_words[i], result);
 
 got_it:
       continue;
diff --git a/glib/tests/logging.c b/glib/tests/logging.c
index e246cdf5b..25bde869a 100644
--- a/glib/tests/logging.c
+++ b/glib/tests/logging.c
@@ -435,9 +435,8 @@ expect_log_writer (GLogLevelFlags   log_level,
       char *str;
 
       str = g_log_writer_format_fields (log_level, fields, n_fields, FALSE);
-      g_test_message ("Unexpected message: %s", str);
+      g_test_fail_message ("Unexpected message: %s", str);
       g_free (str);
-      g_test_fail ();
     }
 
   return G_LOG_WRITER_HANDLED;
@@ -529,9 +528,8 @@ test_structured_logging_roundtrip1 (void)
       ExpectedMessage *expected = expected_messages->data;
 
       str = g_log_writer_format_fields (0, expected->fields, expected->n_fields, FALSE);
-      g_test_message ("Unexpected message: %s", str);
+      g_test_fail_message ("Unexpected message: %s", str);
       g_free (str);
-      g_test_fail ();
     }
 }
 


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