mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 05:56:14 +01:00
gio/tests/socket: Update to check the error code
Only treat IPv6 as unsupported if the attempt to create a socket returns G_IO_ERROR_NOT_SUPPORTED: any other error is a bug.
This commit is contained in:
parent
9fc35dbfb6
commit
befc111c43
@ -1053,18 +1053,24 @@ main (int argc,
|
|||||||
char *argv[])
|
char *argv[])
|
||||||
{
|
{
|
||||||
GSocket *sock;
|
GSocket *sock;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
sock = g_socket_new (G_SOCKET_FAMILY_IPV6,
|
sock = g_socket_new (G_SOCKET_FAMILY_IPV6,
|
||||||
G_SOCKET_TYPE_STREAM,
|
G_SOCKET_TYPE_STREAM,
|
||||||
G_SOCKET_PROTOCOL_DEFAULT,
|
G_SOCKET_PROTOCOL_DEFAULT,
|
||||||
NULL);
|
&error);
|
||||||
if (sock != NULL)
|
if (sock != NULL)
|
||||||
{
|
{
|
||||||
ipv6_supported = TRUE;
|
ipv6_supported = TRUE;
|
||||||
g_object_unref (sock);
|
g_object_unref (sock);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED);
|
||||||
|
g_clear_error (&error);
|
||||||
|
}
|
||||||
|
|
||||||
g_test_add_func ("/socket/ipv4_sync", test_ipv4_sync);
|
g_test_add_func ("/socket/ipv4_sync", test_ipv4_sync);
|
||||||
g_test_add_func ("/socket/ipv4_async", test_ipv4_async);
|
g_test_add_func ("/socket/ipv4_async", test_ipv4_async);
|
||||||
|
Loading…
Reference in New Issue
Block a user