1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2025-08-19 13:29:49 +00:00

Add unit test for IniFile and improve parser.

The test still fails because for some reason the parser
doesn't want to skip the trailing spaces in values.
This commit is contained in:
King_DuckZ 2017-05-06 02:01:05 +01:00
parent b4291becf0
commit 5b59ca3c41
4 changed files with 120 additions and 14 deletions

View file

@ -23,6 +23,7 @@
#include <sstream>
#include <cstdint>
#include <spdlog/spdlog.h>
#include <stdexcept>
TEST_CASE ("Add and retrieve values from SettingsBag", "[settings][ini]") {
using tawashi::SettingsBag;
@ -58,6 +59,9 @@ TEST_CASE ("Add and retrieve values from SettingsBag", "[settings][ini]") {
CHECK(settings.as<std::string>("redis_mode") == "inet");
CHECK(settings["base_uri"] == "http://127.0.0.1:8080");
CHECK_THROWS_AS(settings["not_in_ini"], std::out_of_range);
CHECK_THROWS_AS(settings.at("not_in_ini"), std::out_of_range);
settings.add_default("redis_server", "192.168.0.5");
settings.add_default("not_in_ini_empty", "");
settings.add_default("not_in_ini", "abcd");