aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.core/guard.test.cc
blob: 43076f538b817eb48e207eb8e4bbe81366e9738c (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.core;

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

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

	REQUIRE(n == 1);
}