diff --git a/src/queues.c b/src/queues.c index 427e6b9..24a8b9f 100644 --- a/src/queues.c +++ b/src/queues.c @@ -538,7 +538,10 @@ static void teardown_notification(gpointer data) void queues_teardown(void) { g_queue_free_full(history, teardown_notification); + history = NULL; g_queue_free_full(displayed, teardown_notification); + displayed = NULL; g_queue_free_full(waiting, teardown_notification); + waiting = NULL; } /* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */ diff --git a/test/queues.c b/test/queues.c index 93f8c25..55a59df 100644 --- a/test/queues.c +++ b/test/queues.c @@ -12,9 +12,27 @@ TEST test_queue_init(void) PASS(); } +TEST test_queue_teardown(void) +{ + queues_init(); + QUEUE_LEN_ALL(0, 0, 0); + + struct notification *n = test_notification("n", -1); + queues_notification_insert(n); + + queues_teardown(); + + ASSERT(waiting == NULL); + ASSERT(displayed == NULL); + ASSERT(history == NULL); + + PASS(); +} + SUITE(suite_queues) { RUN_TEST(test_queue_init); + RUN_TEST(test_queue_teardown); } /* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */