1 // Copyright 2015, Tobias Hermann and the FunctionalPlus contributors.
2 // https://github.com/Dobiasd/FunctionalPlus
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 //  http://www.boost.org/LICENSE_1_0.txt)
6 
7 #include <doctest/doctest.h>
8 #include <fplus/fplus.hpp>
9 
10 TEST_CASE("raii_test - make_raii")
11 {
12     std::string log = "nothing";
__anonf9c9503a0102() 13     const auto init = [&log]() { log = "init"; };
__anonf9c9503a0202() 14     const auto quit = [&log]() { log = "quit"; };
15 
16     REQUIRE_EQ(log, "nothing");
17     {
18         REQUIRE_EQ(log, "nothing");
19         const auto ressource = fplus::make_raii(init, quit);
20         REQUIRE_EQ(log, "init");
21     }
22     REQUIRE_EQ(log, "quit");
23 }
24