mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 23:46:15 +01:00
tests: Always check an address is valid before checking it’s supported
This gets us extra test coverage for free. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
e458b0168e
commit
685d605832
@ -44,6 +44,8 @@ assert_is_supported_address (const gchar *address)
|
|||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
|
g_assert_true (g_dbus_is_address (address));
|
||||||
|
|
||||||
g_assert_true (g_dbus_is_supported_address (address, NULL));
|
g_assert_true (g_dbus_is_supported_address (address, NULL));
|
||||||
g_assert_true (g_dbus_is_supported_address (address, &error));
|
g_assert_true (g_dbus_is_supported_address (address, &error));
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
@ -54,6 +56,8 @@ assert_not_supported_address (const gchar *address)
|
|||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
|
g_assert_true (g_dbus_is_address (address));
|
||||||
|
|
||||||
g_assert_false (g_dbus_is_supported_address (address, NULL));
|
g_assert_false (g_dbus_is_supported_address (address, NULL));
|
||||||
g_assert_false (g_dbus_is_supported_address (address, &error));
|
g_assert_false (g_dbus_is_supported_address (address, &error));
|
||||||
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT);
|
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT);
|
||||||
@ -67,10 +71,8 @@ test_unix_address (void)
|
|||||||
assert_not_supported_address ("some-imaginary-transport:foo=bar");
|
assert_not_supported_address ("some-imaginary-transport:foo=bar");
|
||||||
assert_is_supported_address ("unix:path=/tmp/dbus-test");
|
assert_is_supported_address ("unix:path=/tmp/dbus-test");
|
||||||
assert_is_supported_address ("unix:abstract=/tmp/dbus-another-test");
|
assert_is_supported_address ("unix:abstract=/tmp/dbus-another-test");
|
||||||
g_assert_true (g_dbus_is_address ("unix:foo=bar"));
|
|
||||||
assert_not_supported_address ("unix:foo=bar");
|
assert_not_supported_address ("unix:foo=bar");
|
||||||
g_assert_false (g_dbus_is_address ("unix:path=/foo;abstract=/bar"));
|
g_assert_false (g_dbus_is_address ("unix:path=/foo;abstract=/bar"));
|
||||||
assert_not_supported_address ("unix:path=/foo;abstract=/bar");
|
|
||||||
assert_is_supported_address ("unix:path=/tmp/concrete;unix:abstract=/tmp/abstract");
|
assert_is_supported_address ("unix:path=/tmp/concrete;unix:abstract=/tmp/abstract");
|
||||||
g_assert_true (g_dbus_is_address ("some-imaginary-transport:foo=bar"));
|
g_assert_true (g_dbus_is_address ("some-imaginary-transport:foo=bar"));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user