Commit 88695412 authored by Marian Triebe's avatar Marian Triebe

Improve unpublish unit test

parent 1791357c
...@@ -57,6 +57,14 @@ uint16_t publish_at_some_port(uint16_t first_port, actor whom) { ...@@ -57,6 +57,14 @@ uint16_t publish_at_some_port(uint16_t first_port, actor whom) {
} }
} }
actor invalid_unpublish(uint16_t port) {
auto d = spawn<dummy>();
io::unpublish(d, port);
anon_send_exit(d, exit_reason::user_shutdown);
d = invalid_actor;
return io::remote_actor("127.0.0.1", port);
}
} // namespace <anonymous> } // namespace <anonymous>
int main() { int main() {
...@@ -64,6 +72,7 @@ int main() { ...@@ -64,6 +72,7 @@ int main() {
auto d = spawn<dummy>(); auto d = spawn<dummy>();
auto port = publish_at_some_port(4242, d); auto port = publish_at_some_port(4242, d);
std::this_thread::sleep_for(std::chrono::milliseconds(50)); std::this_thread::sleep_for(std::chrono::milliseconds(50));
CAF_CHECK_EQUAL(invalid_unpublish(port), d);
io::unpublish(d, port); io::unpublish(d, port);
CAF_CHECKPOINT(); CAF_CHECKPOINT();
// must fail now // must fail now
...@@ -77,6 +86,6 @@ int main() { ...@@ -77,6 +86,6 @@ int main() {
d = invalid_actor; d = invalid_actor;
await_all_actors_done(); await_all_actors_done();
shutdown(); shutdown();
CAF_CHECK_EQUAL(s_dtor_called.load(), 1); CAF_CHECK_EQUAL(s_dtor_called.load(), 2);
return CAF_TEST_RESULT(); return CAF_TEST_RESULT();
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment