[glib-networking] Fix use of vanilla g_assert() in testsuite



commit 783f10ebc59ad76652f60629f43008a395760563
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Tue Sep 22 13:25:12 2020 -0500

    Fix use of vanilla g_assert() in testsuite
    
    We should use test asserts instead.
    
    Fixes #137

 tls/tests/certificate.c     | 2 +-
 tls/tests/dtls-connection.c | 4 ++--
 tls/tests/file-database.c   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/tls/tests/certificate.c b/tls/tests/certificate.c
index 81e2ebbe..a2129f84 100644
--- a/tls/tests/certificate.c
+++ b/tls/tests/certificate.c
@@ -560,7 +560,7 @@ main (int   argc,
 
   g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
   g_setenv ("GIO_USE_TLS", BACKEND, TRUE);
-  g_assert (g_ascii_strcasecmp (G_OBJECT_TYPE_NAME (g_tls_backend_get_default ()), "GTlsBackend" BACKEND) == 
0);
+  g_assert_cmpint (g_ascii_strcasecmp (G_OBJECT_TYPE_NAME (g_tls_backend_get_default ()), "GTlsBackend" 
BACKEND), ==, 0);
 
   g_test_add ("/tls/" BACKEND "/certificate/create-pem", TestCertificate, NULL,
               setup_certificate, test_create_pem, teardown_certificate);
diff --git a/tls/tests/dtls-connection.c b/tls/tests/dtls-connection.c
index 99a7986b..815b005e 100644
--- a/tls/tests/dtls-connection.c
+++ b/tls/tests/dtls-connection.c
@@ -116,7 +116,7 @@ setup_connection (TestConnection *test, gconstpointer data)
           g_main_context_iteration (NULL, FALSE);         \
         }                                                 \
                                                           \
-      g_assert (!(var));                                  \
+      g_assert_true (!(var));                             \
     }
 
 static void
@@ -791,7 +791,7 @@ main (int   argc,
 
   g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
   g_setenv ("GIO_USE_TLS", BACKEND, TRUE);
-  g_assert (g_ascii_strcasecmp (G_OBJECT_TYPE_NAME (g_tls_backend_get_default ()), "GTlsBackend" BACKEND) == 
0);
+  g_assert_cmpint (g_ascii_strcasecmp (G_OBJECT_TYPE_NAME (g_tls_backend_get_default ()), "GTlsBackend" 
BACKEND), ==, 0);
 
   g_test_add ("/dtls/" BACKEND "/connection/basic/blocking", TestConnection, &blocking,
               setup_connection, test_basic_connection, teardown_connection);
diff --git a/tls/tests/file-database.c b/tls/tests/file-database.c
index a3e62c89..13468a70 100644
--- a/tls/tests/file-database.c
+++ b/tls/tests/file-database.c
@@ -544,7 +544,7 @@ main (int   argc,
 
   g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
   g_setenv ("GIO_USE_TLS", BACKEND, TRUE);
-  g_assert (g_ascii_strcasecmp (G_OBJECT_TYPE_NAME (g_tls_backend_get_default ()), "GTlsBackend" BACKEND) == 
0);
+  g_assert_cmpint (g_ascii_strcasecmp (G_OBJECT_TYPE_NAME (g_tls_backend_get_default ()), "GTlsBackend" 
BACKEND), ==, 0);
 
   g_test_add_func ("/tls/" BACKEND "/backend/default-database-is-singleton",
                    test_default_database_is_singleton);


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