@@ -14,9 +14,9 @@ TEST_CASE("create destroy", "[active_poller]")
1414}
1515
1616static_assert (!std::is_copy_constructible<zmq::active_poller_t >::value,
17- " active_active_poller_t should not be copy-constructible" );
17+ " active_poller_t should not be copy-constructible" );
1818static_assert (!std::is_copy_assignable<zmq::active_poller_t >::value,
19- " active_active_poller_t should not be copy-assignable" );
19+ " active_poller_t should not be copy-assignable" );
2020
2121static const zmq::active_poller_t ::handler_type no_op_handler =
2222 [](zmq::event_flags) {};
@@ -115,12 +115,19 @@ TEST_CASE("add handler invalid events type", "[active_poller]")
115115
116116TEST_CASE (" add handler twice throws" , " [active_poller]" )
117117{
118- zmq::context_t context;
119- zmq::socket_t socket{context, zmq::socket_type::router};
118+ common_server_client_setup s;
119+
120+ CHECK (s.client .send (zmq::message_t {}, zmq::send_flags::none));
121+
120122 zmq::active_poller_t active_poller;
121- active_poller.add (socket, zmq::event_flags::pollin, no_op_handler);
123+ bool message_received = false ;
124+ active_poller.add (
125+ s.server , zmq::event_flags::pollin,
126+ [&message_received](zmq::event_flags) { message_received = true ; });
122127 CHECK_THROWS_ZMQ_ERROR (
123- EINVAL, active_poller.add (socket, zmq::event_flags::pollin, no_op_handler));
128+ EINVAL, active_poller.add (s.server , zmq::event_flags::pollin, no_op_handler));
129+ CHECK (1 == active_poller.wait (std::chrono::milliseconds{-1 }));
130+ CHECK (message_received); // handler unmodified
124131}
125132
126133TEST_CASE (" wait with no handlers throws" , " [active_poller]" )
0 commit comments