#include #include TEST_CASE("Check behavior when whitespace is involved") { SECTION("Simple multi-line config") { using Required = Garbage::SimpleConf::Required; std::string rawConfig = " key with whitespace = and value too \n" "another=one\n" " and yet = another"; Garbage::SimpleConf config(std::move(rawConfig)); REQUIRE(config.Get("key with whitespace") == "and value too"); REQUIRE(config.Get("another") == "one"); REQUIRE(config.Get("and yet") == "another"); } SECTION("Deal with CRLF correctly") { using Required = Garbage::SimpleConf::Required; std::string rawConfig = " simple key=simple value \r\n" " another = one\r\n" " and one = more\r\n"; Garbage::SimpleConf config(std::move(rawConfig)); REQUIRE(config.Get("simple key") == "simple value"); REQUIRE(config.Get("another") == "one"); REQUIRE(config.Get("and one") == "more"); } SECTION("Weirder whitespace shenanigans") { using Required = Garbage::SimpleConf::Required; std::string rawConfig = "let's+start_simple=with some\tbasics\n" "\t\tnow we get \tsome=\t \tweirder\tstuff\r\n" "\t\tinsa+nity\twith\t\t=\t white \t space \t\t"; Garbage::SimpleConf config(std::move(rawConfig)); REQUIRE(config.Get("let's+start_simple") == "with some\tbasics"); REQUIRE(config.Get("now we get \tsome") == "weirder\tstuff"); REQUIRE(config.Get("insa+nity\twith") == "white \t space"); } }