2 * Copyright (c) Meta Platforms, Inc. and affiliates.
5 * This source code is licensed under both the BSD-style license (found in the
6 * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7 * in the COPYING file in the root directory of this source tree).
9 #include "utils/ScopeGuard.h"
11 #include <gtest/gtest.h>
13 using namespace pzstd;
15 TEST(ScopeGuard, Dismiss) {
17 auto guard = makeScopeGuard([&] { EXPECT_TRUE(false); });
22 TEST(ScopeGuard, Executes) {
23 bool executed = false;
25 auto guard = makeScopeGuard([&] { executed = true; });
27 EXPECT_TRUE(executed);