stuff-from-scratch/test/core/TestTomlReader.cpp

25 lines
615 B
C++
Raw Normal View History

2022-10-09 16:39:46 +00:00
#include "TomlReader.h"
2022-11-29 18:00:19 +00:00
#include "TestFramework.h"
2022-10-09 16:39:46 +00:00
#include <filesystem>
2022-10-11 18:39:14 +00:00
#include <iostream>
2022-10-09 16:39:46 +00:00
2022-11-29 18:00:19 +00:00
TEST_CASE(TestTomlReader, "core")
2022-10-09 16:39:46 +00:00
{
const auto data_loc = std::filesystem::path(__FILE__) / "../../data";
const auto sample_toml_file = data_loc / "sample_toml.toml";
2022-10-09 16:39:46 +00:00
auto reader = TomlReader();
reader.read(sample_toml_file);
2022-10-09 16:39:46 +00:00
auto themes_table = reader.getContent()->getTable("themes");
2022-11-30 18:28:50 +00:00
REQUIRE(themes_table);
for (const auto& items : themes_table->getKeyValuePairs())
{
std::cout << "Got entry with key: " << items.first << " and val " << items.second << std::endl;
}
}