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