| //===- llvm/unittest/ADT/ScopeExit.cpp - Scope exit unit tests --*- C++ -*-===// |
| // The LLVM Compiler Infrastructure |
| // This file is distributed under the University of Illinois Open Source |
| // License. See LICENSE.TXT for details. |
| //===----------------------------------------------------------------------===// |
| #include "llvm/ADT/ScopeExit.h" |
| TEST(ScopeExitTest, Basic) { |
| Callable(bool &Called) : Called(Called) {} |
| Callable(Callable &&RHS) : Called(RHS.Called) {} |
| void operator()() { Called = true; } |
| auto g = make_scope_exit(Callable(Called)); |
| TEST(ScopeExitTest, Release) { |
| auto Increment = [&] { ++Count; }; |
| auto G = make_scope_exit(Increment); |
| auto G = make_scope_exit(Increment); |
| } // end anonymous namespace |