mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-18 02:08:09 +08:00
use FetchContent to retrieve TOML test data
This commit is contained in:
@@ -10,10 +10,11 @@
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <deque>
|
||||
#include <toml11/test/files.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_example)
|
||||
{
|
||||
const auto data = toml::parse("toml/tests/example.toml");
|
||||
const auto data = toml::parse(toml::test::file::example);
|
||||
|
||||
BOOST_TEST(toml::find<std::string>(data, "title") == "TOML Example");
|
||||
const auto& owner = toml::find(data, "owner");
|
||||
@@ -76,7 +77,7 @@ BOOST_AUTO_TEST_CASE(test_example)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_example_stream)
|
||||
{
|
||||
std::ifstream ifs("toml/tests/example.toml");
|
||||
std::ifstream ifs(toml::test::file::example);
|
||||
const auto data = toml::parse(ifs);
|
||||
|
||||
BOOST_TEST(toml::find<std::string>(data, "title") == "TOML Example");
|
||||
@@ -144,7 +145,7 @@ BOOST_AUTO_TEST_CASE(test_example_stream)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_fruit)
|
||||
{
|
||||
const auto data = toml::parse("toml/tests/fruit.toml");
|
||||
const auto data = toml::parse(toml::test::file::fruit);
|
||||
const auto blah = toml::find<toml::array>(toml::find(data, "fruit"), "blah");
|
||||
BOOST_TEST(toml::find<std::string>(blah.at(0), "name") == "apple");
|
||||
BOOST_TEST(toml::find<std::string>(blah.at(1), "name") == "banana");
|
||||
@@ -162,7 +163,7 @@ BOOST_AUTO_TEST_CASE(test_fruit)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_hard_example)
|
||||
{
|
||||
const auto data = toml::parse("toml/tests/hard_example.toml");
|
||||
const auto data = toml::parse(toml::test::file::hard_example);
|
||||
const auto the = toml::find(data, "the");
|
||||
BOOST_TEST(toml::find<std::string>(the, "test_string") ==
|
||||
"You'll hate me after this - #");
|
||||
@@ -189,7 +190,7 @@ BOOST_AUTO_TEST_CASE(test_hard_example)
|
||||
}
|
||||
BOOST_AUTO_TEST_CASE(test_hard_example_comment)
|
||||
{
|
||||
const auto data = toml::parse<toml::preserve_comments>("toml/tests/hard_example.toml");
|
||||
const auto data = toml::parse<toml::preserve_comments>(toml::test::file::hard_example);
|
||||
const auto the = toml::find(data, "the");
|
||||
BOOST_TEST(toml::find<std::string>(the, "test_string") ==
|
||||
"You'll hate me after this - #");
|
||||
@@ -218,7 +219,7 @@ BOOST_AUTO_TEST_CASE(test_hard_example_comment)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_example_preserve_comment)
|
||||
{
|
||||
const auto data = toml::parse<toml::preserve_comments>("toml/tests/example.toml");
|
||||
const auto data = toml::parse<toml::preserve_comments>(toml::test::file::example);
|
||||
|
||||
BOOST_TEST(toml::find<std::string>(data, "title") == "TOML Example");
|
||||
const auto& owner = toml::find(data, "owner");
|
||||
@@ -301,7 +302,7 @@ BOOST_AUTO_TEST_CASE(test_example_preserve_comment)
|
||||
BOOST_AUTO_TEST_CASE(test_example_preserve_stdmap_stddeque)
|
||||
{
|
||||
const auto data = toml::parse<toml::preserve_comments, std::map, std::deque
|
||||
>("toml/tests/example.toml");
|
||||
>(toml::test::file::example);
|
||||
|
||||
static_assert(std::is_same<typename decltype(data)::table_type,
|
||||
std::map<toml::key, typename std::remove_cv<decltype(data)>::type>
|
||||
|
Reference in New Issue
Block a user