aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.guard/test.cc
blob: f1b3f214bc5454ee927951d8aaa4d6cf2066f2a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// This source code is released into the public domain.

#include <catch2/catch_test_macros.hpp>

import nihil.guard;

TEST_CASE("guard: basic", "[guard]") {
	int n = 0;

	{
		auto guard = nihil::guard([&] { n = 1; });
		REQUIRE(n == 0);
	}

	REQUIRE(n == 1);
}