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 Jul 24, 2024
1 parent fc1905d commit 196b482
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 196b482

Please sign in to comment.