[SimpleConf] Expand tests, add tiny quality tweaks
This commit is contained in:
parent
a2b0361d86
commit
67d28c276b
3 changed files with 27 additions and 4 deletions
|
@ -16,6 +16,7 @@ target_sources(TestSimpleConf
|
|||
Comments.cpp
|
||||
Conversions.cpp
|
||||
EmptyConfigs.cpp
|
||||
Files.cpp
|
||||
Optionality.cpp
|
||||
Parsing.cpp
|
||||
WhitespaceBehaviour.cpp
|
||||
|
|
23
Tests/SimpleConf/Files.cpp
Normal file
23
Tests/SimpleConf/Files.cpp
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue