summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-02-15 01:02:27 +0100
committerlouiz’ <louiz@louiz.org>2017-02-15 01:07:32 +0100
commit7f08cf83aa5db58bfac004dddae565e6536eeb2c (patch)
treecc8a62788a6c82abeda802da9285e35cbf6002ce /tests
parentfa6635e5487c3efe536c36a27be0ee10b918a346 (diff)
downloadbiboumi-7f08cf83aa5db58bfac004dddae565e6536eeb2c.tar.gz
biboumi-7f08cf83aa5db58bfac004dddae565e6536eeb2c.tar.bz2
biboumi-7f08cf83aa5db58bfac004dddae565e6536eeb2c.tar.xz
biboumi-7f08cf83aa5db58bfac004dddae565e6536eeb2c.zip
Little scopeguard cleanup, and add a test
Diffstat (limited to 'tests')
-rw-r--r--tests/utils.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/utils.cpp b/tests/utils.cpp
index 48951da..d1f0edf 100644
--- a/tests/utils.cpp
+++ b/tests/utils.cpp
@@ -8,6 +8,7 @@
#include <utils/empty_if_fixed_server.hpp>
#include <utils/get_first_non_empty.hpp>
#include <utils/time.hpp>
+#include <utils/scopeguard.hpp>
using namespace std::string_literals;
@@ -140,3 +141,13 @@ TEST_CASE("parse_datetime")
CHECK(utils::parse_datetime("1970-01-02T00:00:12*00:00") == -1);
CHECK(utils::parse_datetime("1970-01-02T00:00:12+0000") == -1);
}
+
+TEST_CASE("scope_guard")
+{
+ bool res = false;
+ {
+ auto guard = utils::make_scope_guard([&res](){ res = true; });
+ CHECK(!res);
+ }
+ CHECK(res);
+}