Skip to content
Snippets Groups Projects
Commit 8d70f217 authored by Nick Mathewson's avatar Nick Mathewson :game_die:
Browse files

Add a test for pubsub_items_clear_bindings()

parent b11b4b7b
No related branches found
No related tags found
No related merge requests found
......@@ -131,6 +131,14 @@ test_pubsub_build_types_ok(void *arg)
tt_assert(items);
tt_int_op(smartlist_len(items->items), OP_EQ, 4);
// Make sure that the bindings got build correctly.
SMARTLIST_FOREACH_BEGIN(items->items, pubsub_cfg_t *, item) {
if (item->is_publish) {
tt_assert(item->pub_binding);
tt_ptr_op(item->pub_binding->dispatch_ptr, OP_EQ, dispatcher);
}
} SMARTLIST_FOREACH_END(item);
tt_int_op(dispatcher->n_types, OP_GE, 2);
tt_assert(dispatcher->typefns);
......@@ -138,6 +146,16 @@ test_pubsub_build_types_ok(void *arg)
tt_assert(dispatcher->typefns[get_msg_type_id("string")].fmt_fn ==
ex_str_fmt);
// Now clear the bindings, like we would do before freeing the
// the dispatcher.
pubsub_items_clear_bindings(items);
SMARTLIST_FOREACH_BEGIN(items->items, pubsub_cfg_t *, item) {
if (item->is_publish) {
tt_assert(item->pub_binding);
tt_ptr_op(item->pub_binding->dispatch_ptr, OP_EQ, NULL);
}
} SMARTLIST_FOREACH_END(item);
done:
pubsub_connector_free(c);
pubsub_builder_free(b);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment