#include #include #include TEST_CASE("Ensure robust parsing") { std::filesystem::path configs("TestConfigs"); using Catch::Matchers::ContainsSubstring; SECTION("Multiple assignments") { REQUIRE_THROWS_WITH(Garbage::SimpleConf(configs / "Parsing-MultipleEquals.conf"), ContainsSubstring("[Line 3]")); } SECTION("Hash in key") { REQUIRE_THROWS_WITH(Garbage::SimpleConf(configs / "Parsing-HashInKey.conf"), ContainsSubstring("[Line 6]")); } SECTION("No equals") { REQUIRE_THROWS_WITH(Garbage::SimpleConf(configs / "Parsing-OnlyKey.conf"), ContainsSubstring("[Line 7]")); } SECTION("Empty key") { REQUIRE_THROWS_WITH(Garbage::SimpleConf(configs / "Parsing-EmptyKey.conf"), ContainsSubstring("[Line 7]")); } SECTION("Key at end of file") { REQUIRE_THROWS_WITH(Garbage::SimpleConf(configs / "Parsing-KeyAtEnd.conf"), ContainsSubstring("[Line 10]")); } }