diff options
Diffstat (limited to 'test/actor/actor_ref.test.cpp')
-rw-r--r-- | test/actor/actor_ref.test.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/actor/actor_ref.test.cpp b/test/actor/actor_ref.test.cpp index 52b0de295b..20aa1c35c1 100644 --- a/test/actor/actor_ref.test.cpp +++ b/test/actor/actor_ref.test.cpp @@ -62,6 +62,28 @@ TEST(ActorRef, Ask) { EXPECT_EQ(30, ref.ask(&Test::echo, 30).get()); } +TEST(ActorRef, AskVoid) { + // Ask waits for void methods + + struct Test { + bool& executed; + + Test(bool& executed_) : executed(executed_) { + } + + void doIt() { + executed = true; + } + }; + + ThreadPool pool { 1 }; + bool executed = false; + Actor<Test> actor(pool, executed); + ActorRef<Test> ref = actor.self(); + + ref.ask(&Test::doIt).get(); + EXPECT_TRUE(executed); +} TEST(ActorRef, AskOnDestroyedActor) { // Tests behavior when calling ask() after the |