mirror of https://github.com/polybar/polybar.git
tests: Convert scope test to gtest
This commit is contained in:
parent
f983bb63bb
commit
53c87558c9
|
@ -1,21 +1,19 @@
|
||||||
#include "common/test.hpp"
|
#include "common/test.hpp"
|
||||||
#include "utils/scope.hpp"
|
#include "utils/scope.hpp"
|
||||||
|
|
||||||
int main() {
|
|
||||||
using namespace polybar;
|
using namespace polybar;
|
||||||
|
|
||||||
"on_exit"_test = [] {
|
TEST(Scope, onExit) {
|
||||||
auto flag = false;
|
auto flag = false;
|
||||||
{
|
{
|
||||||
expect(!flag);
|
EXPECT_FALSE(flag);
|
||||||
auto handler = scope_util::make_exit_handler<>([&] { flag = true; });
|
auto handler = scope_util::make_exit_handler<>([&] { flag = true; });
|
||||||
expect(!flag);
|
EXPECT_FALSE(flag);
|
||||||
{
|
{
|
||||||
auto handler = scope_util::make_exit_handler<>([&] { flag = true; });
|
auto handler = scope_util::make_exit_handler<>([&] { flag = true; });
|
||||||
}
|
}
|
||||||
expect(flag);
|
EXPECT_TRUE(flag);
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
expect(flag);
|
EXPECT_TRUE(flag);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue