summaryrefslogtreecommitdiff
path: root/tests/config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/config.cpp')
-rw-r--r--tests/config.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/config.cpp b/tests/config.cpp
new file mode 100644
index 0000000..1419f0b
--- /dev/null
+++ b/tests/config.cpp
@@ -0,0 +1,25 @@
+#include "catch.hpp"
+
+#include <config/config.hpp>
+
+TEST_CASE("Config basic")
+{
+ Config::filename = "test.cfg";
+ Config::file_must_exist = false;
+ Config::set("coucou", "bonjour", true);
+ Config::close();
+
+ bool error = false;
+ try
+ {
+ Config::file_must_exist = true;
+ CHECK(Config::get("coucou", "") == "bonjour");
+ CHECK(Config::get("does not exist", "default") == "default");
+ Config::close();
+ }
+ catch (const std::ios::failure& e)
+ {
+ error = true;
+ }
+ CHECK_FALSE(error);
+}