@@ -14,9 +14,9 @@ TEST_CASE("create destroy", "[active_poller]")
14
14
}
15
15
16
16
static_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" );
18
18
static_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" );
20
20
21
21
static const zmq::active_poller_t ::handler_type no_op_handler =
22
22
[](zmq::event_flags) {};
@@ -115,12 +115,19 @@ TEST_CASE("add handler invalid events type", "[active_poller]")
115
115
116
116
TEST_CASE (" add handler twice throws" , " [active_poller]" )
117
117
{
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
+
120
122
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 ; });
122
127
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
124
131
}
125
132
126
133
TEST_CASE (" wait with no handlers throws" , " [active_poller]" )
0 commit comments