diff --git a/unit/test-gobex.c b/unit/test-gobex.c
index 76e70d4..1f5c8b9 100644
--- a/unit/test-gobex.c
+++ b/unit/test-gobex.c
#include <gobex/gobex.h>
-static void test_ref_unref(void)
+static GObex *create_gobex(int fd)
{
- GObex *obex;
GIOChannel *io;
- io = g_io_channel_unix_new(STDIN_FILENO);
+ io = g_io_channel_unix_new(fd);
g_assert(io != NULL);
- obex = g_obex_new(io);
+ return g_obex_new(io);
+}
+
+static void test_ref_unref(void)
+{
+ GObex *obex;
+
+ obex = create_gobex(STDIN_FILENO);
g_assert(obex != NULL);
static void test_basic(void)
{
GObex *obex;
- GIOChannel *io;
-
- io = g_io_channel_unix_new(STDIN_FILENO);
- g_assert(io != NULL);
- obex = g_obex_new(io);
+ obex = create_gobex(STDIN_FILENO);
g_assert(obex != NULL);