[SimpleConf] Expand tests, add tiny quality tweaks

This commit is contained in:
TennesseeTrash 2025-06-09 01:41:53 +02:00
parent a2b0361d86
commit 67d28c276b
3 changed files with 27 additions and 4 deletions

View file

@ -16,6 +16,7 @@ target_sources(TestSimpleConf
Comments.cpp
Conversions.cpp
EmptyConfigs.cpp
Files.cpp
Optionality.cpp
Parsing.cpp
WhitespaceBehaviour.cpp

View file

@ -0,0 +1,23 @@
#include <catch2/catch_test_macros.hpp>
#include <Garbage/SimpleConf.hpp>
TEST_CASE("Interactions with files")
{
SECTION("Try loading a nonexistent file")
{
using ReadError = Garbage::SimpleConfImplementation::ReadError;
std::filesystem::path path("TestConfigs/ThisOneShouldntExist.conf");
REQUIRE_THROWS_AS(Garbage::SimpleConf(path), ReadError);
}
SECTION("Try loading a directory")
{
using ReadError = Garbage::SimpleConfImplementation::ReadError;
std::filesystem::path path("TestConfigs");
REQUIRE_THROWS_AS(Garbage::SimpleConf(path), ReadError);
}
}