Commit 57bd8726 authored by Dominik Charousset's avatar Dominik Charousset

Add test for `exit_reason::kill`

parent 13f62877
...@@ -894,6 +894,26 @@ CAF_TEST(test_custom_exception_handler) { ...@@ -894,6 +894,26 @@ CAF_TEST(test_custom_exception_handler) {
); );
} }
CAF_TEST(test_kill) {
auto wannabe_immortal = spawn([](event_based_actor* self) -> behavior {
self->trap_exit(true);
return {
others >> [] {
CAF_TEST_ERROR("Unexpected message");
}
};
});
scoped_actor self;
self->monitor(wannabe_immortal);
self->send_exit(wannabe_immortal, exit_reason::kill);
self->receive(
[&](const down_msg& dm) {
CAF_CHECK(dm.reason == exit_reason::kill);
CAF_CHECK(dm.source == wannabe_immortal);
}
);
}
CAF_TEST(test_exit_reason_scoped_actor) { CAF_TEST(test_exit_reason_scoped_actor) {
// test setting exit reasons for scoped actors // test setting exit reasons for scoped actors
{ // lifetime scope of self { // lifetime scope of self
......
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