blob: 11f7d379a70fc0b671ffbb7432c63099d73d8638 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
/*
* This source code is released into the public domain.
*/
#include <catch2/catch_test_macros.hpp>
import nihil.guard;
using namespace std::literals;
TEST_CASE("guard: basic", "[guard]") {
int n = 0;
{
auto guard = nihil::guard([&] { n = 1; });
REQUIRE(n == 0);
}
REQUIRE(n == 1);
}
|