[glib: 2/3] tests: Use g_assert_*() rather than g_assert() in gdbus-peer-object-manager
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 2/3] tests: Use g_assert_*() rather than g_assert() in gdbus-peer-object-manager
- Date: Fri, 29 Apr 2022 08:04:33 +0000 (UTC)
commit 77416fc023a3235d39c0e9fa0dff566240fe5801
Author: Philip Withnall <pwithnall endlessos org>
Date: Tue Apr 12 13:28:47 2022 +0100
tests: Use g_assert_*() rather than g_assert() in gdbus-peer-object-manager
It won’t get compiled out with `G_DISABLE_ASSERT`.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
gio/tests/gdbus-peer-object-manager.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/gio/tests/gdbus-peer-object-manager.c b/gio/tests/gdbus-peer-object-manager.c
index 4177728e78..0be403f79c 100644
--- a/gio/tests/gdbus-peer-object-manager.c
+++ b/gio/tests/gdbus-peer-object-manager.c
@@ -180,10 +180,10 @@ on_server_connection (GObject *source,
Test *test = user_data;
GError *error = NULL;
- g_assert (test->server == NULL);
+ g_assert_null (test->server);
test->server = g_dbus_connection_new_finish (result, &error);
g_assert_no_error (error);
- g_assert (test->server != NULL);
+ g_assert_nonnull (test->server);
if (test->server && test->client)
g_main_loop_quit (test->loop);
@@ -197,10 +197,10 @@ on_client_connection (GObject *source,
Test *test = user_data;
GError *error = NULL;
- g_assert (test->client == NULL);
+ g_assert_null (test->client);
test->client = g_dbus_connection_new_finish (result, &error);
g_assert_no_error (error);
- g_assert (test->client != NULL);
+ g_assert_nonnull (test->client);
if (test->server && test->client)
g_main_loop_quit (test->loop);
@@ -231,7 +231,7 @@ setup (Test *test,
g_assert_no_error (error);
stream = g_socket_connection_factory_create_connection (socket);
- g_assert (stream != NULL);
+ g_assert_nonnull (stream);
g_object_unref (socket);
guid = g_dbus_generate_guid ();
@@ -247,7 +247,7 @@ setup (Test *test,
g_assert_no_error (error);
stream = g_socket_connection_factory_create_connection (socket);
- g_assert (stream != NULL);
+ g_assert_nonnull (stream);
g_object_unref (socket);
g_dbus_connection_new (G_IO_STREAM (stream), NULL,
@@ -257,8 +257,8 @@ setup (Test *test,
g_main_loop_run (test->loop);
- g_assert (test->server);
- g_assert (test->client);
+ g_assert_nonnull (test->server);
+ g_assert_nonnull (test->client);
g_object_unref (stream);
}
@@ -278,7 +278,7 @@ on_result (GObject *source,
gpointer user_data)
{
Test *test = user_data;
- g_assert (test->result == NULL);
+ g_assert_null (test->result);
test->result = g_object_ref (result);
g_main_loop_quit (test->loop);
@@ -337,28 +337,28 @@ test_object_manager (Test *test,
g_clear_object (&test->result);
proxy = g_dbus_object_manager_get_interface (client, number1_path, "org.mock.Interface");
- g_assert (proxy != NULL);
+ g_assert_nonnull (proxy);
prop = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Path");
- g_assert (prop != NULL);
+ g_assert_nonnull (prop);
g_assert_cmpstr ((gchar *)g_variant_get_type (prop), ==, (gchar *)G_VARIANT_TYPE_OBJECT_PATH);
g_assert_cmpstr (g_variant_get_string (prop, NULL), ==, number1_path);
g_variant_unref (prop);
prop = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Number");
- g_assert (prop != NULL);
+ g_assert_nonnull (prop);
g_assert_cmpstr ((gchar *)g_variant_get_type (prop), ==, (gchar *)G_VARIANT_TYPE_INT32);
g_assert_cmpint (g_variant_get_int32 (prop), ==, 1);
g_variant_unref (prop);
g_object_unref (proxy);
proxy = g_dbus_object_manager_get_interface (client, number2_path, "org.mock.Interface");
- g_assert (proxy != NULL);
+ g_assert_nonnull (proxy);
prop = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Path");
- g_assert (prop != NULL);
+ g_assert_nonnull (prop);
g_assert_cmpstr ((gchar *)g_variant_get_type (prop), ==, (gchar *)G_VARIANT_TYPE_OBJECT_PATH);
g_assert_cmpstr (g_variant_get_string (prop, NULL), ==, number2_path);
g_variant_unref (prop);
prop = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Number");
- g_assert (prop != NULL);
+ g_assert_nonnull (prop);
g_assert_cmpstr ((gchar *)g_variant_get_type (prop), ==, (gchar *)G_VARIANT_TYPE_INT32);
g_assert_cmpint (g_variant_get_int32 (prop), ==, 2);
g_variant_unref (prop);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]