Branch data Line data Source code
1 : : #include <gio/gio.h> 2 : : 3 : : static void 4 : 1 : test_autoptr (void) 5 : : { 6 : 2 : g_autoptr(GFile) p = g_file_new_for_path ("/blah"); 7 : 2 : g_autoptr(GInetAddress) a = g_inet_address_new_from_string ("127.0.0.1"); 8 : 2 : g_autofree gchar *path = g_file_get_path (p); 9 : 2 : g_autofree gchar *istr = g_inet_address_to_string (a); 10 : : 11 : 1 : g_assert_cmpstr (path, ==, G_DIR_SEPARATOR_S "blah"); 12 : 1 : g_assert_cmpstr (istr, ==, "127.0.0.1"); 13 : 1 : } 14 : : 15 : : int 16 : 1 : main (int argc, char *argv[]) 17 : : { 18 : 1 : g_test_init (&argc, &argv, NULL); 19 : : 20 : 1 : g_test_add_func ("/autoptr/autoptr", test_autoptr); 21 : : 22 : 1 : return g_test_run (); 23 : : }