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:
Dan Winship 2014-03-21 16:57:56 -04:00
parent 9fc35dbfb6
commit befc111c43

View File

@ -1053,18 +1053,24 @@ main (int argc,
char *argv[])
{
GSocket *sock;
GError *error = NULL;
g_test_init (&argc, &argv, NULL);
sock = g_socket_new (G_SOCKET_FAMILY_IPV6,
G_SOCKET_TYPE_STREAM,
G_SOCKET_PROTOCOL_DEFAULT,
NULL);
&error);
if (sock != NULL)
{
ipv6_supported = TRUE;
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_async", test_ipv4_async);