From 66887c225b63cecea62d17bcfae40cddef38c9d1 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sat, 31 Oct 2015 05:35:46 +0100 Subject: Add a few tests --- tests/utils.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/utils.cpp') 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 #include #include +#include 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"); + } + +} -- cgit v1.2.3