1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-10-27 05:23:39 -04:00
polybar/tests/unit_tests/utils/scope.cpp
2018-06-10 16:42:07 +02:00

19 lines
406 B
C++

#include "common/test.hpp"
#include "utils/scope.hpp"
using namespace polybar;
TEST(Scope, onExit) {
auto flag = false;
{
EXPECT_FALSE(flag);
auto handler = scope_util::make_exit_handler<>([&] { flag = true; });
EXPECT_FALSE(flag);
{
auto handler = scope_util::make_exit_handler<>([&] { flag = true; });
}
EXPECT_TRUE(flag);
flag = false;
}
EXPECT_TRUE(flag);
}