Add a few tests

This commit is contained in:
Florent Le Coz
2015-10-31 05:35:46 +01:00
parent 73fd710cfd
commit 66887c225b
5 changed files with 101 additions and 1 deletions
+18
View File
@@ -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");
}
}