Commit 0383264d authored by Simon McVittie's avatar Simon McVittie
Browse files

Merge branch 'wip/smcv/better-assertions' into 'master'

Use better assertions

See merge request !3
parents 06a7fac3 a23a0a2e
Pipeline #290625 passed with stage
in 2 minutes and 11 seconds
......@@ -3333,85 +3333,85 @@ _dbus_gobject_test (const char *test_data_dir)
/* DoNothing */
arg = method_arg_info_from_object_info (&dbus_glib_internal_test_object_info,
&(dbus_glib_internal_test_methods[0]));
g_assert (*arg == '\0');
g_assert_cmpint (*arg, ==, '\0');
/* Increment */
arg = method_arg_info_from_object_info (&dbus_glib_internal_test_object_info,
&(dbus_glib_internal_test_methods[1]));
g_assert (*arg != '\0');
g_assert_cmpint (*arg, !=, '\0');
arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature);
g_assert (!strcmp (arg_name, "x"));
g_assert (arg_in == TRUE);
g_assert (!strcmp (arg_signature, "u"));
g_assert (*arg != '\0');
g_assert_cmpstr (arg_name, ==, "x");
g_assert_true (arg_in);
g_assert_cmpstr (arg_signature, ==, "u");
g_assert_cmpint (*arg, !=, '\0');
arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature);
g_assert (arg_in == FALSE);
g_assert (retval == RETVAL_NONE);
g_assert (!strcmp (arg_signature, "u"));
g_assert (*arg == '\0');
g_assert_false (arg_in);
g_assert_cmpint (retval, ==, RETVAL_NONE);
g_assert_cmpstr (arg_signature, ==, "u");
g_assert_cmpint (*arg, ==, '\0');
/* IncrementRetval */
arg = method_arg_info_from_object_info (&dbus_glib_internal_test_object_info,
&(dbus_glib_internal_test_methods[2]));
g_assert (*arg != '\0');
g_assert_cmpint (*arg, !=, '\0');
arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature);
g_assert (!strcmp (arg_name, "x"));
g_assert (arg_in == TRUE);
g_assert (!strcmp (arg_signature, "u"));
g_assert (*arg != '\0');
g_assert_cmpstr (arg_name, ==, "x");
g_assert_true (arg_in);
g_assert_cmpstr (arg_signature, ==, "u");
g_assert_cmpint (*arg, !=, '\0');
arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature);
g_assert (retval == RETVAL_NOERROR);
g_assert (arg_in == FALSE);
g_assert (!strcmp (arg_signature, "u"));
g_assert (*arg == '\0');
g_assert_cmpint (retval, ==, RETVAL_NOERROR);
g_assert_false (arg_in);
g_assert_cmpstr (arg_signature, ==, "u");
g_assert_cmpint (*arg, ==, '\0');
/* IncrementRetvalError */
arg = method_arg_info_from_object_info (&dbus_glib_internal_test_object_info,
&(dbus_glib_internal_test_methods[3]));
g_assert (*arg != '\0');
g_assert_cmpint (*arg, !=, '\0');
arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature);
g_assert (!strcmp (arg_name, "x"));
g_assert (arg_in == TRUE);
g_assert (!strcmp (arg_signature, "u"));
g_assert (*arg != '\0');
g_assert_cmpstr (arg_name, ==, "x");
g_assert_true (arg_in);
g_assert_cmpstr (arg_signature, ==, "u");
g_assert_cmpint (*arg, !=, '\0');
arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature);
g_assert (retval == RETVAL_ERROR);
g_assert (arg_in == FALSE);
g_assert (!strcmp (arg_signature, "u"));
g_assert (*arg == '\0');
g_assert_cmpint (retval, ==, RETVAL_ERROR);
g_assert_false (arg_in);
g_assert_cmpstr (arg_signature, ==, "u");
g_assert_cmpint (*arg, ==, '\0');
/* Stringify */
arg = method_arg_info_from_object_info (&dbus_glib_internal_test_object_info,
&(dbus_glib_internal_test_methods[8]));
g_assert (*arg != '\0');
g_assert_cmpint (*arg, !=, '\0');
arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature);
g_assert (!strcmp (arg_name, "val"));
g_assert (arg_in == TRUE);
g_assert (!strcmp (arg_signature, "v"));
g_assert (*arg != '\0');
g_assert_cmpstr (arg_name, ==, "val");
g_assert_true (arg_in);
g_assert_cmpstr (arg_signature, ==, "v");
g_assert_cmpint (*arg, !=, '\0');
arg = arg_iterate (arg, &arg_name, &arg_in, &constval, &retval, &arg_signature);
g_assert (retval == RETVAL_NONE);
g_assert (arg_in == FALSE);
g_assert (!strcmp (arg_signature, "s"));
g_assert (*arg == '\0');
g_assert_cmpint (retval, ==, RETVAL_NONE);
g_assert_false (arg_in);
g_assert_cmpstr (arg_signature, ==, "s");
g_assert_cmpint (*arg, ==, '\0');
sigdata = dbus_glib_internal_test_object_info.exported_signals;
g_assert (*sigdata != '\0');
sigdata = signal_iterate (sigdata, &iface, &signame);
g_assert (!strcmp (iface, "org.freedesktop.DBus.Tests.MyObject"));
g_assert (!strcmp (signame, "Frobnicate"));
g_assert_cmpstr (iface, ==, "org.freedesktop.DBus.Tests.MyObject");
g_assert_cmpstr (signame, ==, "Frobnicate");
g_assert (*sigdata != '\0');
sigdata = signal_iterate (sigdata, &iface, &signame);
g_assert (!strcmp (iface, "org.freedesktop.DBus.Tests.FooObject"));
g_assert (!strcmp (signame, "Sig0"));
g_assert_cmpstr (iface, ==, "org.freedesktop.DBus.Tests.FooObject");
g_assert_cmpstr (signame, ==, "Sig0");
g_assert (*sigdata != '\0');
sigdata = signal_iterate (sigdata, &iface, &signame);
g_assert (!strcmp (iface, "org.freedesktop.DBus.Tests.FooObject"));
g_assert (!strcmp (signame, "Sig1"));
g_assert_cmpstr (iface, ==, "org.freedesktop.DBus.Tests.FooObject");
g_assert_cmpstr (signame, ==, "Sig1");
g_assert (*sigdata != '\0');
sigdata = signal_iterate (sigdata, &iface, &signame);
g_assert (!strcmp (iface, "org.freedesktop.DBus.Tests.FooObject"));
g_assert (!strcmp (signame, "Sig2"));
g_assert_cmpstr (iface, ==, "org.freedesktop.DBus.Tests.FooObject");
g_assert_cmpstr (signame, ==, "Sig2");
g_assert (*sigdata == '\0');
......
......@@ -2028,15 +2028,15 @@ assert_type_maps_to (GType gtype, const char *expected_sig)
{
char *sig;
sig = _dbus_gtype_to_signature (gtype);
g_assert (sig != NULL);
g_assert (!strcmp (expected_sig, sig));
g_assert_nonnull (sig);
g_assert_cmpstr (expected_sig, ==, sig);
g_free (sig);
}
static void
assert_signature_maps_to (const char *sig, GType expected_gtype)
{
g_assert (_dbus_gtype_from_signature (sig, TRUE) == expected_gtype);
g_assert_cmpuint (_dbus_gtype_from_signature (sig, TRUE), ==, expected_gtype);
}
static void
......@@ -2074,26 +2074,26 @@ _dbus_gvalue_test (const char *test_data_dir)
DBUS_STRUCT_BEGIN_CHAR_AS_STRING DBUS_TYPE_INT32_AS_STRING DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_OBJECT_PATH_AS_STRING DBUS_STRUCT_END_CHAR_AS_STRING );
rectype = dbus_g_type_get_collection ("GArray", G_TYPE_UINT);
g_assert (rectype != G_TYPE_INVALID);
g_assert (!strcmp (g_type_name (rectype), "GArray_guint_"));
g_assert_cmpuint (rectype, !=, G_TYPE_INVALID);
g_assert_cmpstr (g_type_name (rectype), ==, "GArray_guint_");
type = _dbus_gtype_from_signature ("au", TRUE);
g_assert (type == rectype);
g_assert_cmpuint (type, ==, rectype);
rectype = dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING);
g_assert (rectype != G_TYPE_INVALID);
g_assert (!strcmp (g_type_name (rectype), "GHashTable_gchararray+gchararray_"));
g_assert_cmpuint (rectype, !=, G_TYPE_INVALID);
g_assert_cmpstr (g_type_name (rectype), ==, "GHashTable_gchararray+gchararray_");
type = _dbus_gtype_from_signature ("a{ss}", TRUE);
g_assert (type == rectype);
g_assert_cmpuint (type, ==, rectype);
type = _dbus_gtype_from_signature ("o", FALSE);
g_assert (type == DBUS_TYPE_G_OBJECT_PATH);
g_assert_cmpuint (type, ==, DBUS_TYPE_G_OBJECT_PATH);
type = _dbus_gtype_from_signature ("o", TRUE);
g_assert (type == DBUS_TYPE_G_OBJECT_PATH);
g_assert_cmpuint (type, ==, DBUS_TYPE_G_OBJECT_PATH);
type = _dbus_gtype_from_signature ("g", TRUE);
g_assert (type == DBUS_TYPE_G_SIGNATURE);
g_assert_cmpuint (type, ==, DBUS_TYPE_G_SIGNATURE);
return TRUE;
}
......
......@@ -88,17 +88,17 @@ setup (Fixture *f,
f->conn = dbus_g_bus_get_private (DBUS_BUS_SESSION, NULL, &f->error);
g_assert_no_error (f->error);
g_assert (f->conn != NULL);
g_assert_nonnull (f->conn);
f->object = g_object_new (MY_TYPE_OBJECT, NULL);
g_assert (MY_IS_OBJECT (f->object));
g_assert_true (MY_IS_OBJECT (f->object));
dbus_g_connection_register_g_object (f->conn, "/com/example/Test/Object",
f->object);
f->proxy = dbus_g_proxy_new_for_name (f->conn,
dbus_bus_get_unique_name (dbus_g_connection_get_connection (f->conn)),
"/com/example/Test/Object", "org.freedesktop.DBus.GLib.Tests.MyObject");
g_assert (f->proxy != NULL);
g_assert_nonnull (f->proxy);
}
static void
......@@ -108,7 +108,7 @@ throw_error_cb (DBusGProxy *proxy,
{
Fixture *f = user_data;
g_assert (error != NULL);
g_assert_nonnull (error);
g_clear_error (&f->error);
g_free (f->error_name);
f->error = g_error_copy (error);
......
......@@ -68,21 +68,21 @@ setup (Fixture *f,
f->conn = dbus_g_bus_get_private (DBUS_BUS_SESSION, NULL, &f->error);
g_assert_no_error (f->error);
g_assert (f->conn != NULL);
g_assert_nonnull (f->conn);
f->proxy = dbus_g_proxy_new_for_name (f->conn, "com.example.Test",
"/com/example/Test/Object", "com.example.Test.Fallible");
g_assert (f->proxy != NULL);
g_assert_nonnull (f->proxy);
f->object = g_object_new (MY_TYPE_OBJECT, NULL);
g_assert (MY_IS_OBJECT (f->object));
g_assert_true (MY_IS_OBJECT (f->object));
dbus_g_connection_register_g_object (f->conn, "/com/example/Test/Object",
f->object);
f->proxy_for_self = dbus_g_proxy_new_for_name (f->conn,
dbus_bus_get_unique_name (dbus_g_connection_get_connection (f->conn)),
"/com/example/Test/Object", "org.freedesktop.DBus.GLib.Tests.MyObject");
g_assert (f->proxy_for_self != NULL);
g_assert_nonnull (f->proxy_for_self);
}
static void
......@@ -194,7 +194,7 @@ throw_error_cb (DBusGProxy *proxy,
{
GError **error_out = user_data;
g_assert (error != NULL);
g_assert_nonnull (error);
*error_out = g_error_copy (error);
}
......
......@@ -50,7 +50,7 @@ frobnicate_signal_handler (DBusGProxy *proxy, int val, void *user_data)
{
n_times_frobnicate_received += 1;
g_assert (val == 42);
g_assert_cmpint (val, ==, 42);
g_main_loop_quit (loop);
g_source_remove (exit_timeout);
......@@ -95,7 +95,7 @@ main (int argc, char **argv)
g_error ("Cannot open connection: %s", error->message);
proxy = dbus_g_proxy_new_for_peer (conn, "/", "org.freedesktop.DBus.GLib.Tests.MyObject");
g_assert (proxy);
g_assert_nonnull (proxy);
if (!dbus_g_proxy_call (proxy, "DoNothing", &error, G_TYPE_INVALID, G_TYPE_INVALID))
......
......@@ -56,10 +56,10 @@ setup (Fixture *f,
gconstpointer path_to_use)
{
f->bus = dbus_g_bus_get_private (DBUS_BUS_SESSION, NULL, NULL);
g_assert (f->bus != NULL);
g_assert_nonnull (f->bus);
f->bus2 = dbus_g_bus_get_private (DBUS_BUS_SESSION, NULL, NULL);
g_assert (f->bus2 != NULL);
g_assert_nonnull (f->bus2);
}
static void
......
......@@ -62,8 +62,8 @@ call_cb (DBusGProxy *proxy,
{
Fixture *f = user_data;
g_assert (proxy == f->proxy);
g_assert (call == f->call);
g_assert_true (proxy == f->proxy);
g_assert_true (call == f->call);
f->in_flight--;
}
......@@ -75,7 +75,7 @@ frobnicate_cb (DBusGProxy *proxy,
{
Fixture *f = user_data;
g_assert (proxy == f->proxy);
g_assert_true (proxy == f->proxy);
f->in_flight--;
......@@ -91,10 +91,10 @@ setup (Fixture *f,
f->in_flight = 0;
f->bus = dbus_g_bus_get_private (DBUS_BUS_SESSION, f->context, NULL);
g_assert (f->bus != NULL);
g_assert_nonnull (f->bus);
f->object = g_object_new (MY_TYPE_OBJECT, NULL);
g_assert (MY_IS_OBJECT (f->object));
g_assert_true (MY_IS_OBJECT (f->object));
dbus_g_connection_register_g_object (f->bus, "/object",
(GObject *) f->object);
......@@ -169,7 +169,7 @@ test_call (Fixture *f,
G_TYPE_INVALID);
g_assert_no_error (error);
g_assert (ok);
g_assert_true (ok);
g_assert_cmpuint (result, ==, 667);
}
......@@ -239,7 +239,7 @@ test_timeout (Fixture *f,
G_TYPE_INVALID);
g_assert_error (error, DBUS_GERROR, DBUS_GERROR_NO_REPLY);
g_assert (!ok);
g_assert_false (ok);
g_clear_error (&error);
}
......
......@@ -84,7 +84,7 @@ auth_result_cb (DBusGProxy *proxy,
{
Fixture *f = user_data;
g_assert (proxy == f->proxy);
g_assert_true (proxy == f->proxy);
g_ptr_array_add (f->auth_results, g_strdup (res));
}
......@@ -101,14 +101,14 @@ setup (Fixture *f,
f->service_gconn = dbus_g_bus_get_private (DBUS_BUS_SESSION, NULL,
&f->error);
g_assert_no_error (f->error);
g_assert (f->service_gconn != NULL);
g_assert_nonnull (f->service_gconn);
f->service_conn = dbus_g_connection_get_connection (f->service_gconn);
/* An attacker that intends to pretend to be that service. */
f->attacker_gconn = dbus_g_bus_get_private (DBUS_BUS_SESSION, NULL,
&f->error);
g_assert_no_error (f->error);
g_assert (f->attacker_gconn != NULL);
g_assert_nonnull (f->attacker_gconn);
f->attacker_conn = dbus_g_connection_get_connection (f->attacker_gconn);
/* The service owns a well-known name. */
......@@ -120,12 +120,12 @@ setup (Fixture *f,
/* The victim of the attack. */
f->client_gconn = dbus_g_bus_get_private (DBUS_BUS_SESSION, NULL, &f->error);
g_assert_no_error (f->error);
g_assert (f->client_gconn != NULL);
g_assert_nonnull (f->client_gconn);
f->client_conn = dbus_g_connection_get_connection (f->client_gconn);
f->proxy = dbus_g_proxy_new_for_name (f->client_gconn, WELL_KNOWN_NAME,
PATH, IFACE);
g_assert (DBUS_IS_G_PROXY (f->proxy));
g_assert_true (DBUS_IS_G_PROXY (f->proxy));
/* The proxy is listening for the signal. */
f->auth_results = g_ptr_array_new_with_free_func (g_free);
......
......@@ -69,7 +69,7 @@ new_conn_cb (DBusServer *server,
{
Fixture *f = data;
g_assert (f->server_conn == NULL);
g_assert_null (f->server_conn);
f->server_conn = dbus_connection_ref (server_conn);
dbus_connection_setup_with_g_main (server_conn, NULL);
f->server_gconn = dbus_connection_get_g_connection (server_conn);
......@@ -81,7 +81,7 @@ destroy_cb (DBusGProxy *proxy,
{
Fixture *f = user_data;
g_assert (proxy == f->proxy);
g_assert_true (proxy == f->proxy);
f->proxy_destroyed = TRUE;
}
......@@ -94,18 +94,18 @@ setup (Fixture *f,
f->server = dbus_server_listen (addr, &f->e);
assert_no_error (&f->e);
g_assert (f->server != NULL);
g_assert_nonnull (f->server);
dbus_server_set_new_connection_function (f->server,
new_conn_cb, f, NULL);
dbus_server_setup_with_g_main (f->server, NULL);
g_assert (f->server_conn == NULL);
g_assert_null (f->server_conn);
f->client_conn = dbus_connection_open_private (
dbus_server_get_address (f->server), &f->e);
assert_no_error (&f->e);
g_assert (f->client_conn != NULL);
g_assert_nonnull (f->client_conn);
dbus_connection_setup_with_g_main (f->client_conn, NULL);
f->client_gconn = dbus_connection_get_g_connection (f->client_conn);
......@@ -123,8 +123,8 @@ setup (Fixture *f,
f->proxy = dbus_g_proxy_new_for_peer (f->client_gconn,
"/org/freedesktop/DBus/GLib/Tests/MyTestObject",
"org.freedesktop.DBus.GLib.Tests.MyObject");
g_assert (f->proxy != NULL);
g_assert (DBUS_IS_G_PROXY (f->proxy));
g_assert_nonnull (f->proxy);
g_assert_true (DBUS_IS_G_PROXY (f->proxy));
g_signal_connect (f->proxy, "destroy", G_CALLBACK (destroy_cb), f);
......@@ -141,7 +141,7 @@ call_cb (DBusGProxy *proxy,
gboolean found;
found = g_hash_table_remove (f->in_flight, call);
g_assert (found);
g_assert_true (found);
g_hash_table_insert (f->completed, call, call);
}
......@@ -155,7 +155,7 @@ test_method (Fixture *f,
call = dbus_g_proxy_begin_call (f->proxy, "DoNothing", call_cb, f, NULL,
G_TYPE_INVALID);
g_assert (call != NULL);
g_assert_nonnull (call);
g_hash_table_insert (f->in_flight, call, call);
while (g_hash_table_size (f->in_flight) > 0)
......@@ -165,11 +165,11 @@ test_method (Fixture *f,
}
ok = g_hash_table_remove (f->completed, call);
g_assert (ok);
g_assert_true (ok);
ok = dbus_g_proxy_end_call (f->proxy, call, &error,
G_TYPE_INVALID);
g_assert_no_error (error);
g_assert (ok);
g_assert_true (ok);
}
static void
......@@ -187,12 +187,12 @@ test_disconnect (Fixture *f,
fail = dbus_g_proxy_begin_call (f->proxy, "DoNothing", call_cb, f, NULL,
G_TYPE_INVALID);
g_assert (fail == NULL);
g_assert_null (fail);
ok = dbus_g_proxy_end_call (f->proxy, fail, &error,
G_TYPE_INVALID);
g_assert_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED);
g_assert (!ok);
g_assert_false (ok);
g_clear_error (&error);
while (!f->proxy_destroyed)
......
......@@ -76,13 +76,13 @@ setup (Fixture *f,
dbus_error_init (&f->dbus_error);
f->bus = dbus_g_bus_get_private (DBUS_BUS_SESSION, NULL, NULL);
g_assert (f->bus != NULL);
g_assert_nonnull (f->bus);
f->bus2 = dbus_g_bus_get_private (DBUS_BUS_SESSION, NULL, NULL);
g_assert (f->bus2 != NULL);
g_assert_nonnull (f->bus2);
f->object = g_object_new (MY_TYPE_OBJECT, NULL);
g_assert (MY_IS_OBJECT (f->object));
g_assert_true (MY_IS_OBJECT (f->object));
}
static void
......@@ -124,10 +124,10 @@ test_lookup (Fixture *f,
g_test_bug ("5688");
dbus_g_connection_register_g_object (f->bus, "/foo", f->object);
g_assert (dbus_g_connection_lookup_g_object (f->bus, "/foo") ==
g_assert_true (dbus_g_connection_lookup_g_object (f->bus, "/foo") ==
f->object);
/* this was briefly broken while fixing fd.o#5688 */
g_assert (dbus_g_connection_lookup_g_object (f->bus, "/bar") == NULL);
g_assert_null (dbus_g_connection_lookup_g_object (f->bus, "/bar"));
}
static void
......@@ -138,10 +138,10 @@ test_unregister (Fixture *f,
g_test_bug ("21219");
dbus_g_connection_register_g_object (f->bus, "/foo", f->object);
g_assert (dbus_g_connection_lookup_g_object (f->bus, "/foo") ==
g_assert_true (dbus_g_connection_lookup_g_object (f->bus, "/foo") ==
f->object);
dbus_g_connection_unregister_g_object (f->bus, f->object);
g_assert (dbus_g_connection_lookup_g_object (f->bus, "/foo") == NULL);
g_assert_null (dbus_g_connection_lookup_g_object (f->bus, "/foo"));
}
static void
......@@ -154,15 +154,15 @@ test_unregister_on_last_unref (Fixture *f,
g_object_add_weak_pointer (weak_pointer, &weak_pointer);
dbus_g_connection_register_g_object (f->bus, "/foo", f->object);
g_assert (dbus_g_connection_lookup_g_object (f->bus, "/foo") ==
g_assert_true (dbus_g_connection_lookup_g_object (f->bus, "/foo") ==
f->object);
/* implicit unregistration by the last-unref of the object */
g_object_unref (f->object);
f->object = NULL;
g_assert (weak_pointer == NULL);
g_assert_null (weak_pointer);
g_assert (dbus_g_connection_lookup_g_object (f->bus, "/foo") == NULL);
g_assert_null (dbus_g_connection_lookup_g_object (f->bus, "/foo"));
}
static void
......@@ -170,13 +170,13 @@ test_unregister_on_forced_dispose (Fixture *f,
gconstpointer test_data G_GNUC_UNUSED)
{
dbus_g_connection_register_g_object (f->bus, "/foo", f->object);
g_assert (dbus_g_connection_lookup_g_object (f->bus, "/foo") ==
g_assert_true (dbus_g_connection_lookup_g_object (f->bus, "/foo") ==
f->object);
/* implicit unregistration by dispose() of the object (don't try
* this at home) */
g_object_run_dispose (f->object);
g_assert (dbus_g_connection_lookup_g_object (f->bus, "/foo") == NULL);
g_assert_null (dbus_g_connection_lookup_g_object (f->bus, "/foo"));
}
static void
......@@ -184,7 +184,7 @@ test_reregister (Fixture *f,
gconstpointer test_data G_GNUC_UNUSED)
{
dbus_g_connection_register_g_object (f->bus, "/foo", f->object);
g_assert (dbus_g_connection_lookup_g_object (f->bus, "/foo") ==
g_assert_true (dbus_g_connection_lookup_g_object (f->bus, "/foo") ==
f->object);
/* Before 0.82, re-registering the same object path was leaky but successful.
......@@ -193,12 +193,12 @@ test_reregister (Fixture *f,
* record of the registrations (while leaving the object registered with
* libdbus). */
dbus_g_connection_register_g_object (f->bus, "/foo", f->object);
g_assert (dbus_g_connection_lookup_g_object (f->bus, "/foo") ==
g_assert_true (dbus_g_connection_lookup_g_object (f->bus, "/foo") ==
f->object);
/* This would critical in 0.84. */
dbus_g_connection_unregister_g_object (f->bus, f->object);
g_assert (dbus_g_connection_lookup_g_object (f->bus, "/foo") == NULL);
g_assert_null (dbus_g_connection_lookup_g_object (f->bus, "/foo"));
}
static DBusHandlerResult
......@@ -214,15 +214,15 @@ frobnicate_cb (DBusConnection *conn,
const char *sender = dbus_message_get_sender (message);
const char *path = dbus_message_get_path (message);
g_assert (sender != NULL);
g_assert (path != NULL);
g_assert_nonnull (sender);
g_assert_nonnull (path);
if (g_strcmp0 (path, "/foo") == 0)
{
g_assert_cmpstr (sender, ==, dbus_bus_get_unique_name (
dbus_g_connection_get_connection (f->bus)));
g_assert (f->frobnicate1_message == NULL);
g_assert_null (f->frobnicate1_message);
f->frobnicate1_message = dbus_message_ref (message);
}
else
......@@ -231,7 +231,7 @@ frobnicate_cb (DBusConnection *conn,
g_assert_cmpstr (sender, ==, dbus_bus_get_unique_name (
dbus_g_connection_get_connection (f->bus2)));
g_assert (f->frobnicate2_message == NULL);
g_assert_null (f->frobnicate2_message);
f->frobnicate2_message = dbus_message_ref (message);
}
}
......@@ -251,9 +251,9 @@ test_twice (Fixture *f,