diff --git a/test/test-callback-stack.c b/test/test-callback-stack.c index 10aa3cbb..d0a0939f 100644 --- a/test/test-callback-stack.c +++ b/test/test-callback-stack.c @@ -1,6 +1,9 @@ #include "../oio.h" #include "test.h" +/* TODO: Add explanation of why we want on_close to be called from fresh + * stack. + */ int nested = 0; int close_cb_called = 0; @@ -18,19 +21,22 @@ TEST_IMPL(close_cb_stack) { oio_init(); - if (oio_tcp_handle_init(&handle, &close_cb, NULL)) + if (oio_tcp_handle_init(&handle, &close_cb, NULL)) { FATAL(oio_tcp_handle_init failed) + } nested++; - if (oio_close(&handle)) + if (oio_close(&handle)) { FATAL(oio_close failed) + } nested--; oio_run(); - ASSERT(close_cb_called && "oio_close_cb must be called exactly once") + ASSERT(nested == 0) + ASSERT(close_cb_called == 1 && "oio_close_cb must be called exactly once") return 0; -} \ No newline at end of file +}