Files
dl_old/third/LuaBridge3/Tests/Source/ScopeGuardTests.cpp
T
2026-04-28 18:52:55 +08:00

30 lines
561 B
C++
Vendored

// https://github.com/kunitoki/LuaBridge3
// Copyright 2022, kunitoki
// SPDX-License-Identifier: MIT
#include "TestBase.h"
TEST(ScopeGuardTests, ExecuteAtScopeExit)
{
bool executed = false;
{
const luabridge::detail::ScopeGuard sg([&] { executed = true; });
luabridge::unused(sg);
}
EXPECT_TRUE(executed);
}
TEST(ScopeGuardTests, ResetDoesNotExecuteAtScopeExit)
{
bool executed = false;
{
luabridge::detail::ScopeGuard sg([&] { executed = true; });
sg.reset();
}
EXPECT_FALSE(executed);
}