summaryrefslogtreecommitdiff
path: root/tests/utils.cpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2015-10-31 05:35:46 +0100
committerFlorent Le Coz <louiz@louiz.org>2015-10-31 05:35:46 +0100
commit66887c225b63cecea62d17bcfae40cddef38c9d1 (patch)
treebf69037dc6ddbb96edbd09ee952bd73ce8689798 /tests/utils.cpp
parent73fd710cfd003022e4d28d98b4d3242e80d7dd52 (diff)
downloadbiboumi-66887c225b63cecea62d17bcfae40cddef38c9d1.tar.gz
biboumi-66887c225b63cecea62d17bcfae40cddef38c9d1.tar.bz2
biboumi-66887c225b63cecea62d17bcfae40cddef38c9d1.tar.xz
biboumi-66887c225b63cecea62d17bcfae40cddef38c9d1.zip
Add a few tests
Diffstat (limited to 'tests/utils.cpp')
-rw-r--r--tests/utils.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/utils.cpp b/tests/utils.cpp
index 6e3c32a..8691910 100644
--- a/tests/utils.cpp
+++ b/tests/utils.cpp
@@ -5,6 +5,7 @@
#include <utils/string.hpp>
#include <utils/split.hpp>
#include <utils/xdg.hpp>
+#include <utils/empty_if_fixed_server.hpp>
TEST_CASE("String split")
{
@@ -70,3 +71,20 @@ TEST_CASE("xdg_*_path")
CHECK(res == "/datadir/biboumi/bonjour.txt");
}
}
+
+TEST_CASE("empty if fixed irc server")
+{
+ GIVEN("A config with fixed_irc_server")
+ {
+ Config::set("fixed_irc_server", "irc.localhost");
+ THEN("our string is made empty")
+ CHECK(utils::empty_if_fixed_server("coucou coucou") == "");
+ }
+ GIVEN("A config with NO fixed_irc_server")
+ {
+ Config::set("fixed_irc_server", "");
+ THEN("our string is returned untouched")
+ CHECK(utils::empty_if_fixed_server("coucou coucou") == "coucou coucou");
+ }
+
+}