Skip to content

Commit

Permalink
Add Event2 stop handling test.
Browse files Browse the repository at this point in the history
  • Loading branch information
crupest committed Feb 2, 2024
1 parent c1e8682 commit 9760767
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/common/Event2Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,16 @@ TEST_CASE("Event2", "[event2]") {
event.Raise();
REQUIRE(counter == 3);
}

SECTION("stop handling should work.") {
auto short_circuit_handler = [&counter](decltype(event)::Context* context) {
context->SetStopHandling();
};

event.AddHandler(short_circuit_handler);
event.AddHandler(handler2);

event.Raise();
REQUIRE(counter == 1);
}
}

0 comments on commit 9760767

Please sign in to comment.