diff options
| author | Lexi Winter <lexi@le-fay.org> | 2025-07-02 03:05:56 +0100 |
|---|---|---|
| committer | Lexi Winter <lexi@le-fay.org> | 2025-07-02 03:05:56 +0100 |
| commit | ca697d6ca0c49f91ca13c72f0bb870d297b26767 (patch) | |
| tree | 1f0e875a019804022b043878fc56404d88becd9a /nihil.util/guard.test.cc | |
| parent | 83eae6f3280b237ff4fb080947658cc91fde9532 (diff) | |
| download | nihil-ca697d6ca0c49f91ca13c72f0bb870d297b26767.tar.gz nihil-ca697d6ca0c49f91ca13c72f0bb870d297b26767.tar.bz2 | |
move guard to util
Diffstat (limited to 'nihil.util/guard.test.cc')
| -rw-r--r-- | nihil.util/guard.test.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/nihil.util/guard.test.cc b/nihil.util/guard.test.cc new file mode 100644 index 0000000..2c3ac2f --- /dev/null +++ b/nihil.util/guard.test.cc @@ -0,0 +1,16 @@ +// This source code is released into the public domain. + +#include <catch2/catch_test_macros.hpp> + +import nihil.util; + +TEST_CASE("guard: basic", "[guard]") { + int n = 0; + + { + auto guard = nihil::guard([&] { n = 1; }); + REQUIRE(n == 0); + } + + REQUIRE(n == 1); +} |
