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




commit 052e335500942184c40ed0b7cabbeb1f94e0d5ab
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..15dcd8f1c 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_printf ("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..ab6014847 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_printf ("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_printf ("Unexpected message: %s", str);
       g_free (str);
-      g_test_fail ();
     }
 }
 


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