tests: Use g_assert_cmpvariant() from GLib 2.60

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2019-03-13 13:18:38 +00:00
parent d9acee829a
commit 418b79ab7f
2 changed files with 2 additions and 23 deletions

View File

@ -48,27 +48,6 @@ assert_strv_equal (const gchar * const *strv_a,
g_assert_null (strv_b[i]); g_assert_null (strv_b[i]);
} }
/* FIXME: Use g_assert_cmpvariant() when
* https://gitlab.gnome.org/GNOME/glib/issues/1191 is fixed. */
#define assert_cmpvariant(v1, v2) \
G_STMT_START \
{ \
GVariant *__v1 = (v1), *__v2 = (v2); \
if (!g_variant_equal (__v1, __v2)) \
{ \
gchar *__s1, *__s2, *__msg; \
__s1 = g_variant_print (__v1, TRUE); \
__s2 = g_variant_print (__v2, TRUE); \
__msg = g_strdup_printf ("assertion failed (" #v1 " == " #v2 "): %s does not equal %s", __s1, __s2); \
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \
g_free (__s1); \
g_free (__s2); \
g_free (__msg); \
} \
} \
G_STMT_END
/* A placeholder smoketest which checks that the error quark works. */ /* A placeholder smoketest which checks that the error quark works. */
static void static void
test_app_filter_error_quark (void) test_app_filter_error_quark (void)
@ -1093,7 +1072,7 @@ set_app_filter_server_cb (GtDBusQueue *queue,
else else
{ {
expected_property_value = g_variant_new_parsed (set_app_filter_data_get_expected_property_value (data, property_name)); expected_property_value = g_variant_new_parsed (set_app_filter_data_get_expected_property_value (data, property_name));
assert_cmpvariant (property_value, expected_property_value); g_assert_cmpvariant (property_value, expected_property_value);
g_dbus_method_invocation_return_value (property_invocation, NULL); g_dbus_method_invocation_return_value (property_invocation, NULL);
} }

View File

@ -1,7 +1,7 @@
deps = [ deps = [
dependency('gio-2.0', version: '>= 2.60.1'), dependency('gio-2.0', version: '>= 2.60.1'),
dependency('gio-unix-2.0', version: '>= 2.44'), dependency('gio-unix-2.0', version: '>= 2.44'),
dependency('glib-2.0', version: '>= 2.54.2'), dependency('glib-2.0', version: '>= 2.60.0'),
dependency('gobject-2.0', version: '>= 2.44'), dependency('gobject-2.0', version: '>= 2.44'),
libmalcontent_dep, libmalcontent_dep,
libglib_testing_dep, libglib_testing_dep,