mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add YAML parser
This commit is contained in:
parent
239181bb64
commit
2aea19febd
8 changed files with 406 additions and 25 deletions
22
test/coders/yaml.cpp
Normal file
22
test/coders/yaml.cpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "coders/yaml.hpp"
|
||||
#include "coders/json.hpp"
|
||||
#include "coders/commons.hpp"
|
||||
|
||||
#include "io/io.hpp"
|
||||
#include "io/devices/StdfsDevice.hpp"
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
TEST(YAML, EncodeDecode) {
|
||||
io::set_device("root", std::make_shared<io::StdfsDevice>(fs::u8path("../../")));
|
||||
auto filename = "root:.github/workflows/windows-clang.yml";
|
||||
try {
|
||||
auto value = yaml::parse(io::read_string(filename));
|
||||
std::cout << json::stringify(value, true) << std::endl;
|
||||
} catch (const parsing_error& error) {
|
||||
std::cerr << error.errorLog() << std::endl;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue