tests: Convert scope test to gtest

This commit is contained in:
patrick96 2018-06-01 15:24:09 +02:00 committed by Patrick Ziegler
parent f983bb63bb
commit 53c87558c9

View File

@ -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);
};
} }