polybar-dwm/tests/unit_tests/utils/scope.cpp
2022-03-06 18:28:26 +01:00

21 lines
369 B
C++

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