[glib] gio/tests/socket: Update to check the error code



commit befc111c435be63bdc6a2d59204f697d26688369
Author: Dan Winship <danw gnome org>
Date:   Fri Mar 21 16:57:56 2014 -0400

    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.

 gio/tests/socket.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gio/tests/socket.c b/gio/tests/socket.c
index 362a1f2..5cc8ee6 100644
--- a/gio/tests/socket.c
+++ b/gio/tests/socket.c
@@ -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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]