diff options
Diffstat (limited to 'nihil.guard/test.cc')
| -rw-r--r-- | nihil.guard/test.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/nihil.guard/test.cc b/nihil.guard/test.cc new file mode 100644 index 0000000..11f7d37 --- /dev/null +++ b/nihil.guard/test.cc @@ -0,0 +1,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); +} |
