Commit a23a0a2e authored by Simon McVittie's avatar Simon McVittie
Browse files

test: Replace remaining assertions with g_assert_true()



Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
parent 344e005c
......@@ -91,7 +91,7 @@ setup (Fixture *f,
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);
......
......@@ -75,7 +75,7 @@ setup (Fixture *f,
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);
......
......@@ -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--;
......@@ -94,7 +94,7 @@ setup (Fixture *f,
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);
}
......
......@@ -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));
}
......@@ -125,7 +125,7 @@ setup (Fixture *f,
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);
......
......@@ -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;
}
......@@ -124,7 +124,7 @@ setup (Fixture *f,
"/org/freedesktop/DBus/GLib/Tests/MyTestObject",
"org.freedesktop.DBus.GLib.Tests.MyObject");
g_assert_nonnull (f->proxy);
g_assert (DBUS_IS_G_PROXY (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);
}
......@@ -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
......
......@@ -82,7 +82,7 @@ setup (Fixture *f,
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,7 +124,7 @@ 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_null (dbus_g_connection_lookup_g_object (f->bus, "/bar"));
......@@ -138,7 +138,7 @@ 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_null (dbus_g_connection_lookup_g_object (f->bus, "/foo"));
......@@ -154,7 +154,7 @@ 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);
......@@ -170,7 +170,7 @@ 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) */
......@@ -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,7 +193,7 @@ 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. */
......@@ -251,9 +251,9 @@ test_twice (Fixture *f,
dbus_g_connection_register_g_object (f->bus2, "/bar", 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);
g_assert (dbus_g_connection_lookup_g_object (f->bus2, "/bar") ==
g_assert_true (dbus_g_connection_lookup_g_object (f->bus2, "/bar") ==
f->object);
dbus_bus_add_match (dbus_g_connection_get_connection (f->bus),
......@@ -261,7 +261,7 @@ test_twice (Fixture *f,
assert_no_error (&f->dbus_error);
mem = dbus_connection_add_filter (dbus_g_connection_get_connection (f->bus),
frobnicate_cb, f, NULL);
g_assert (mem);
g_assert_true (mem);
my_object_emit_frobnicate ((MyObject *) f->object, NULL);
......@@ -299,10 +299,10 @@ test_clean_slate (Fixture *f,
assert_no_error (&f->dbus_error);
mem = dbus_connection_add_filter (dbus_g_connection_get_connection (f->bus),
frobnicate_cb, f, NULL);
g_assert (mem);
g_assert_true (mem);
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);
my_object_emit_frobnicate ((MyObject *) f->object, NULL);
......@@ -317,7 +317,7 @@ test_clean_slate (Fixture *f,
* in the same location */
dbus_g_connection_unregister_g_object (f->bus, f->object);
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);
/* bug: in 0.92, this would be emitted twice because the hook was added
......@@ -334,7 +334,7 @@ test_clean_slate (Fixture *f,
* at a different location */
dbus_g_connection_unregister_g_object (f->bus, f->object);
dbus_g_connection_register_g_object (f->bus2, "/bar", f->object);
g_assert (dbus_g_connection_lookup_g_object (f->bus2, "/bar") ==
g_assert_true (dbus_g_connection_lookup_g_object (f->bus2, "/bar") ==
f->object);
my_object_emit_frobnicate ((MyObject *) f->object, NULL);
......@@ -383,7 +383,7 @@ objectified_cb (DBusConnection *conn,
if (dbus_error_is_set (&e))
g_error ("%s: %s", e.name, e.message);
g_assert (ok);
g_assert_true (ok);
g_assert_cmpstr (path, ==, "/foo");
f->received_objectified = TRUE;
......@@ -401,7 +401,7 @@ test_marshal_object (Fixture *f,
g_test_bug ("37852");
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_bus_add_match (dbus_g_connection_get_connection (f->bus),
......@@ -409,7 +409,7 @@ test_marshal_object (Fixture *f,
assert_no_error (&f->dbus_error);
mem = dbus_connection_add_filter (dbus_g_connection_get_connection (f->bus),
objectified_cb, f, NULL);
g_assert (mem);
g_assert_true (mem);
my_object_emit_objectified ((MyObject *) f->object, f->object);
......
......@@ -110,14 +110,14 @@ test_shared_bus (Fixture *f,
dbus_connection_set_exit_on_disconnect (dbus_g_connection_get_connection (f->bus),
FALSE);
g_assert (f->bus == dbus_g_bus_get (DBUS_BUS_SESSION, NULL));
g_assert (f->bus == dbus_g_bus_get (DBUS_BUS_SESSION, NULL));
g_assert (f->bus == dbus_g_bus_get (DBUS_BUS_SESSION, NULL));
g_assert_true (f->bus == dbus_g_bus_get (DBUS_BUS_SESSION, NULL));
g_assert_true (f->bus == dbus_g_bus_get (DBUS_BUS_SESSION, NULL));
g_assert_true (f->bus == dbus_g_bus_get (DBUS_BUS_SESSION, NULL));
f->priv = dbus_g_bus_get_private (DBUS_BUS_SESSION, NULL, &f->error);
g_assert_no_error (f->error);
g_assert_nonnull (f->priv);
g_assert (f->priv != f->bus);
g_assert_true (f->priv != f->bus);
dbus_connection_set_exit_on_disconnect (dbus_g_connection_get_connection (f->priv),
FALSE);
}
......
......@@ -232,7 +232,7 @@ sig1_signal_handler (DBusGProxy *proxy,
g_assert_cmpstr (str0, ==, "baz");
g_assert (G_VALUE_HOLDS_STRING (value));
g_assert_true (G_VALUE_HOLDS_STRING (value));
g_assert_cmpstr (g_value_get_string (value), ==, "bar");
......@@ -272,7 +272,7 @@ echo_received_cb (DBusGProxy *proxy,
GError *error;
char *echo_data;
g_assert (call == echo_call);
g_assert_true (call == echo_call);
g_assert_null (data);
error = NULL;
......@@ -1202,10 +1202,10 @@ main (int argc, char **argv)
g_assert_nonnull (vals_ret);
g_assert_cmpuint (vals_ret->n_values, ==, 2);
g_assert (G_VALUE_HOLDS_UINT (g_value_array_get_nth (vals_ret, 0)));
g_assert_true (G_VALUE_HOLDS_UINT (g_value_array_get_nth (vals_ret, 0)));
g_assert_cmpuint (g_value_get_uint (g_value_array_get_nth (vals_ret, 0)), ==, 43);
g_assert (G_VALUE_TYPE (g_value_array_get_nth (vals_ret, 1)) == DBUS_TYPE_G_OBJECT_PATH);
g_assert_true (G_VALUE_TYPE (g_value_array_get_nth (vals_ret, 1)) == DBUS_TYPE_G_OBJECT_PATH);
g_assert_cmpstr ("/org/freedesktop/DBus/GLib/Tests/MyTestObject2", ==,
g_value_get_boxed (g_value_array_get_nth (vals_ret, 1)));
......@@ -1265,12 +1265,12 @@ main (int argc, char **argv)
val = g_hash_table_lookup (ret_table, "foo");
g_assert_nonnull (val);
g_assert (G_VALUE_HOLDS_STRING (val));
g_assert_true (G_VALUE_HOLDS_STRING (val));
g_assert_cmpstr ("42", ==, g_value_get_string (val));
val = g_hash_table_lookup (ret_table, "bar");
g_assert_nonnull (val);
g_assert (G_VALUE_HOLDS_STRING (val));
g_assert_true (G_VALUE_HOLDS_STRING (val));
g_assert_cmpstr ("hello", ==, g_value_get_string (val));
g_hash_table_destroy (table);
......@@ -2074,7 +2074,7 @@ main (int argc, char **argv)
G_TYPE_INVALID,
G_TYPE_VALUE, &value, G_TYPE_INVALID))
lose_gerror ("Failed to complete GetProperty call", error);
g_assert (G_VALUE_HOLDS (&value, G_TYPE_STRING));
g_assert_true (G_VALUE_HOLDS (&value, G_TYPE_STRING));
g_assert_cmpstr (g_value_get_string (&value), ==, "");
g_value_unset (&value);
}
......@@ -2101,7 +2101,7 @@ main (int argc, char **argv)
G_TYPE_INVALID,
G_TYPE_VALUE, &value, G_TYPE_INVALID))
lose_gerror ("Failed to complete GetProperty no-touching call", error);
g_assert (G_VALUE_HOLDS (&value, G_TYPE_UINT));
g_assert_true (G_VALUE_HOLDS (&value, G_TYPE_UINT));
g_assert_cmpuint (g_value_get_uint (&value), ==, 42);
g_value_unset (&value);
}
......@@ -2129,7 +2129,7 @@ main (int argc, char **argv)
G_TYPE_INVALID,
G_TYPE_VALUE, &value, G_TYPE_INVALID))
lose_gerror ("Failed to complete GetProperty call", error);
g_assert (G_VALUE_HOLDS (&value, G_TYPE_UINT));
g_assert_true (G_VALUE_HOLDS (&value, G_TYPE_UINT));
g_assert_cmpuint (g_value_get_uint (&value), ==, 42);
g_value_unset (&value);
}
......@@ -2143,7 +2143,7 @@ main (int argc, char **argv)
G_TYPE_INVALID,
G_TYPE_VALUE, &value, G_TYPE_INVALID))
lose_gerror ("Failed to complete GetProperty call", error);
g_assert (G_VALUE_HOLDS (&value, G_TYPE_STRING));
g_assert_true (G_VALUE_HOLDS (&value, G_TYPE_STRING));
g_assert_cmpstr (g_value_get_string (&value), ==, "testing value");
g_value_unset (&value);
}
......@@ -2157,7 +2157,7 @@ main (int argc, char **argv)
G_TYPE_INVALID,
G_TYPE_VALUE, &value, G_TYPE_INVALID))
lose_gerror ("Failed to complete GetProperty call", error);
g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE));
g_assert_true (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE));
g_value_unset (&value);
}
......@@ -2170,7 +2170,7 @@ main (int argc, char **argv)
G_TYPE_INVALID,
G_TYPE_VALUE, &value, G_TYPE_INVALID))
lose_gerror ("Failed to complete GetProperty call", error);
g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE));
g_assert_true (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE));
g_value_unset (&value);
}
......@@ -2183,7 +2183,7 @@ main (int argc, char **argv)
G_TYPE_INVALID,
G_TYPE_VALUE, &value, G_TYPE_INVALID))
lose_gerror ("Failed to complete GetProperty call", error);
g_assert (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE));
g_assert_true (G_VALUE_HOLDS (&value, G_TYPE_DOUBLE));
g_value_unset (&value);
}
......@@ -2211,7 +2211,7 @@ main (int argc, char **argv)
G_TYPE_INVALID,
G_TYPE_VALUE, &value, G_TYPE_INVALID))
lose_gerror ("Failed GetProperty call of \"should-be-hidden\" property", error);
g_assert (G_VALUE_HOLDS_BOOLEAN (&value));
g_assert_true (G_VALUE_HOLDS_BOOLEAN (&value));
g_assert_false (g_value_get_boolean (&value));
g_value_unset (&value);
}
......@@ -2253,7 +2253,7 @@ main (int argc, char **argv)
G_TYPE_INVALID,
G_TYPE_VALUE, &value, G_TYPE_INVALID))
lose_gerror ("Failed GetProperty call of \"should-be-hidden\" property", error);
g_assert (G_VALUE_HOLDS_BOOLEAN (&value));
g_assert_true (G_VALUE_HOLDS_BOOLEAN (&value));
g_assert_false (g_value_get_boolean (&value));
g_value_unset (&value);
}
......@@ -2386,7 +2386,7 @@ main (int argc, char **argv)
if (privconn == NULL)
lose_gerror ("Failed to open private connection to bus", error);
g_assert (privconn != connection);
g_assert_true (privconn != connection);
proxy = dbus_g_proxy_new_for_name (privconn,
"org.freedesktop.DBus.GLib.TestService",
......
......@@ -170,7 +170,7 @@ test_simple_equiv (void)
v1 = g_variant_new_int32 (1984);
v2 = g_variant_new_int32 (1984);
g_assert (test_g_variant_equivalent (v1, v2));
g_assert_true (test_g_variant_equivalent (v1, v2));
g_variant_unref (v1);
g_variant_unref (v2);
......@@ -234,7 +234,7 @@ test_map_equiv (void)
g_variant_builder_add (&b, "{os}", "/cats/josh", "Josh Smith");
v2 = g_variant_builder_end (&b);
g_assert (test_g_variant_equivalent (v1, v2));
g_assert_true (test_g_variant_equivalent (v1, v2));
g_variant_unref (v1);
g_variant_unref (v2);
......@@ -304,7 +304,7 @@ test_i (void)
varc = g_variant_new_int32 (1984);
g_assert (test_g_variant_equivalent (var, varc));
g_assert_true (test_g_variant_equivalent (var, varc));
g_variant_unref (var);
g_variant_unref (varc);
......@@ -324,7 +324,7 @@ test_s (void)
varc = g_variant_new_string ("Orwell");
g_assert (test_g_variant_equivalent (var, varc));
g_assert_true (test_g_variant_equivalent (var, varc));
g_variant_unref (var);
g_variant_unref (varc);
......@@ -344,7 +344,7 @@ test_o (void)
varc = g_variant_new_object_path ("/cats/escher");
g_assert (test_g_variant_equivalent (var, varc));
g_assert_true (test_g_variant_equivalent (var, varc));
g_variant_unref (var);
g_variant_unref (varc);
......@@ -372,7 +372,7 @@ test_us (void)
varc = g_variant_new ("(us)", 1984, "Orwell");
g_assert (test_g_variant_equivalent (var, varc));
g_assert_true (test_g_variant_equivalent (var, varc));
g_variant_unref (var);
g_variant_unref (varc);
......@@ -409,7 +409,7 @@ test_a_os (void)
g_variant_builder_add (&b, "{os}", "/cats/josh", "Josh Smith");
varc = g_variant_builder_end (&b);
g_assert (test_g_variant_equivalent (var, varc));
g_assert_true (test_g_variant_equivalent (var, varc));
g_variant_unref (var);
g_variant_unref (varc);
......@@ -453,7 +453,7 @@ test_av (void)
g_variant_builder_add (&b, "v", g_variant_new_object_path ("/cats/escher"));
varc = g_variant_builder_end (&b);
g_assert (test_g_variant_equivalent (var, varc));
g_assert_true (test_g_variant_equivalent (var, varc));
g_variant_unref (var);
g_variant_unref (varc);
......@@ -486,7 +486,7 @@ test_ab (void)
g_variant_builder_add (&b, "b", FALSE);
varc = g_variant_builder_end (&b);
g_assert (test_g_variant_equivalent (var, varc));
g_assert_true (test_g_variant_equivalent (var, varc));
g_variant_unref (var);
g_variant_unref (varc);
......@@ -519,7 +519,7 @@ test_ai (void)
g_variant_builder_add (&b, "i", 1066);
varc = g_variant_builder_end (&b);
g_assert (test_g_variant_equivalent (var, varc));
g_assert_true (test_g_variant_equivalent (var, varc));
g_variant_unref (var);
g_variant_unref (varc);
......@@ -552,7 +552,7 @@ test_au (void)
g_variant_builder_add (&b, "u", 1066);
varc = g_variant_builder_end (&b);
g_assert (test_g_variant_equivalent (var, varc));
g_assert_true (test_g_variant_equivalent (var, varc));
g_variant_unref (var);
g_variant_unref (varc);
......@@ -592,7 +592,7 @@ test_ax (void)
g_variant_builder_add (&b, "x", G_GINT64_CONSTANT (1066));
varc = g_variant_builder_end (&b);
g_assert (test_g_variant_equivalent (var, varc));
g_assert_true (test_g_variant_equivalent (var, varc));
g_variant_unref (var);
g_variant_unref (varc);
......@@ -631,7 +631,7 @@ test_at (void)
g_variant_builder_add (&b, "t", G_GUINT64_CONSTANT (1066));
varc = g_variant_builder_end (&b);
g_assert (test_g_variant_equivalent (var, varc));
g_assert_true (test_g_variant_equivalent (var, varc));
g_variant_unref (var);
g_variant_unref (varc);
......@@ -664,7 +664,7 @@ test_ay (void)
g_variant_builder_add (&b, "y", 42);
varc = g_variant_builder_end (&b);
g_assert (test_g_variant_equivalent (var, varc));
g_assert_true (test_g_variant_equivalent (var, varc));
g_variant_unref (var);
g_variant_unref (varc);
......@@ -684,7 +684,7 @@ test_g (void)
varc = g_variant_new_signature ("a{u(ua{sa{sv}})}");
g_assert (test_g_variant_equivalent (var, varc));
g_assert_true (test_g_variant_equivalent (var, varc));
g_variant_unref (var);
g_variant_unref (varc);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment