mirror of
https://github.com/polybar/polybar.git
synced 2024-10-27 05:23:39 -04:00
20 lines
369 B
C++
20 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);
|
|
}
|