From fd46bedda3a529fdccef36815856dcb9cc5139f9 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 20 Jun 2011 23:56:04 +0300 Subject: [PATCH] gobex: Refactor basic unit tests --- unit/test-gobex.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/unit/test-gobex.c b/unit/test-gobex.c index 76e70d41b..1f5c8b9b6 100644 --- a/unit/test-gobex.c +++ b/unit/test-gobex.c @@ -23,15 +23,21 @@ #include -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); @@ -44,12 +50,8 @@ static void test_ref_unref(void) 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); -- 2.47.3