2018-04-07 20:16:55 +00:00
|
|
|
#include "common/test.hpp"
|
2016-10-24 23:47:00 +00:00
|
|
|
#include "utils/scope.hpp"
|
|
|
|
|
|
|
|
int main() {
|
2016-11-19 05:22:44 +00:00
|
|
|
using namespace polybar;
|
2016-10-24 23:47:00 +00:00
|
|
|
|
|
|
|
"on_exit"_test = [] {
|
|
|
|
auto flag = false;
|
|
|
|
{
|
|
|
|
expect(!flag);
|
|
|
|
auto handler = scope_util::make_exit_handler<>([&] { flag = true; });
|
|
|
|
expect(!flag);
|
|
|
|
{
|
|
|
|
auto handler = scope_util::make_exit_handler<>([&] { flag = true; });
|
|
|
|
}
|
|
|
|
expect(flag);
|
|
|
|
flag = false;
|
|
|
|
}
|
|
|
|
expect(flag);
|
|
|
|
};
|
|
|
|
}
|