mirror of
https://github.com/ToruNiina/toml11.git
synced 2024-11-08 13:50:06 +00:00
Revert "use FetchContent to retrieve TOML test data"
This reverts commit 4c34986db0
.
This commit is contained in:
parent
fe644ea4b7
commit
a655a71cef
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
enable_testing()
|
||||
|
||||
project(toml11)
|
||||
@ -52,8 +52,6 @@ set(toml11_config_dir ${CMAKE_CURRENT_BINARY_DIR}/cmake/)
|
||||
set(toml11_config ${toml11_config_dir}/toml11Config.cmake)
|
||||
set(toml11_config_version ${toml11_config_dir}/toml11ConfigVersion.cmake)
|
||||
|
||||
add_subdirectory(dependencies)
|
||||
|
||||
add_library(toml11 INTERFACE)
|
||||
target_include_directories(toml11 INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
|
9
dependencies/CMakeLists.txt
vendored
9
dependencies/CMakeLists.txt
vendored
@ -1,9 +0,0 @@
|
||||
include(FetchContent)
|
||||
|
||||
if (toml11_BUILD_TEST)
|
||||
FetchContent_Declare(toml
|
||||
GIT_REPOSITORY https://github.com/toml-lang/toml
|
||||
GIT_TAG v0.5.0)
|
||||
|
||||
FetchContent_MakeAvailable(toml)
|
||||
endif ()
|
@ -1,10 +1,3 @@
|
||||
include(FetchContent)
|
||||
FetchContent_GetProperties(toml)
|
||||
configure_file(include/toml11/test/files.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/include/toml11/test/files.hpp @ONLY)
|
||||
add_library(toml11_test_files INTERFACE)
|
||||
add_library(toml11::test_files ALIAS toml11_test_files)
|
||||
target_include_directories(toml11_test_files INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||
|
||||
set(TEST_NAMES
|
||||
test_datetime
|
||||
test_string
|
||||
@ -150,7 +143,7 @@ add_definitions(-DUNITTEST_FRAMEWORK_LIBRARY_EXIST)
|
||||
|
||||
foreach(TEST_NAME ${TEST_NAMES})
|
||||
add_executable(${TEST_NAME} ${TEST_NAME}.cpp)
|
||||
target_link_libraries(${TEST_NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} toml11::toml11 toml11::test_files)
|
||||
target_link_libraries(${TEST_NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} toml11::toml11)
|
||||
target_include_directories(${TEST_NAME} PRIVATE ${Boost_INCLUDE_DIRS})
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
|
@ -1,26 +0,0 @@
|
||||
// Copyright Toru Niina 2020.
|
||||
// Distributed under the MIT License.
|
||||
#ifndef TOML11_TEST_PATHS_HPP
|
||||
#define TOML11_TEST_PATHS_HPP
|
||||
|
||||
namespace toml {
|
||||
|
||||
namespace test {
|
||||
|
||||
namespace file {
|
||||
|
||||
constexpr char example[]{"@toml_SOURCE_DIR@/tests/example.toml"};
|
||||
|
||||
constexpr char fruit[]{"@toml_SOURCE_DIR@/tests/fruit.toml"};
|
||||
|
||||
constexpr char hard_example[]{"@toml_SOURCE_DIR@/tests/hard_example.toml"};
|
||||
|
||||
constexpr char hard_example_unicode[]{"@toml_SOURCE_DIR@/tests/hard_example_unicode.toml"};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // toml
|
||||
|
||||
#endif// TOML11_TEST_PATHS_HPP
|
@ -10,11 +10,10 @@
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <deque>
|
||||
#include <toml11/test/files.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_example)
|
||||
{
|
||||
const auto data = toml::parse(toml::test::file::example);
|
||||
const auto data = toml::parse("toml/tests/example.toml");
|
||||
|
||||
BOOST_TEST(toml::find<std::string>(data, "title") == "TOML Example");
|
||||
const auto& owner = toml::find(data, "owner");
|
||||
@ -77,7 +76,7 @@ BOOST_AUTO_TEST_CASE(test_example)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_example_stream)
|
||||
{
|
||||
std::ifstream ifs(toml::test::file::example);
|
||||
std::ifstream ifs("toml/tests/example.toml");
|
||||
const auto data = toml::parse(ifs);
|
||||
|
||||
BOOST_TEST(toml::find<std::string>(data, "title") == "TOML Example");
|
||||
@ -145,7 +144,7 @@ BOOST_AUTO_TEST_CASE(test_example_stream)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_fruit)
|
||||
{
|
||||
const auto data = toml::parse(toml::test::file::fruit);
|
||||
const auto data = toml::parse("toml/tests/fruit.toml");
|
||||
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");
|
||||
@ -163,7 +162,7 @@ BOOST_AUTO_TEST_CASE(test_fruit)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_hard_example)
|
||||
{
|
||||
const auto data = toml::parse(toml::test::file::hard_example);
|
||||
const auto data = toml::parse("toml/tests/hard_example.toml");
|
||||
const auto the = toml::find(data, "the");
|
||||
BOOST_TEST(toml::find<std::string>(the, "test_string") ==
|
||||
"You'll hate me after this - #");
|
||||
@ -190,7 +189,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::test::file::hard_example);
|
||||
const auto data = toml::parse<toml::preserve_comments>("toml/tests/hard_example.toml");
|
||||
const auto the = toml::find(data, "the");
|
||||
BOOST_TEST(toml::find<std::string>(the, "test_string") ==
|
||||
"You'll hate me after this - #");
|
||||
@ -219,7 +218,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::test::file::example);
|
||||
const auto data = toml::parse<toml::preserve_comments>("toml/tests/example.toml");
|
||||
|
||||
BOOST_TEST(toml::find<std::string>(data, "title") == "TOML Example");
|
||||
const auto& owner = toml::find(data, "owner");
|
||||
@ -302,7 +301,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::test::file::example);
|
||||
>("toml/tests/example.toml");
|
||||
|
||||
static_assert(std::is_same<typename decltype(data)::table_type,
|
||||
std::map<toml::key, typename std::remove_cv<decltype(data)>::type>
|
||||
|
@ -8,12 +8,11 @@
|
||||
#include <toml.hpp>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <toml11/test/files.hpp>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
BOOST_AUTO_TEST_CASE(test_hard_example_unicode)
|
||||
{
|
||||
const auto data = toml::parse(toml::test::file::hard_example_unicode);
|
||||
const auto data = toml::parse("toml/tests/hard_example_unicode.toml");
|
||||
|
||||
const auto the = toml::find<toml::table>(data, "the");
|
||||
BOOST_TEST(toml::get<std::string>(the.at("test_string")) ==
|
||||
@ -44,7 +43,7 @@ BOOST_AUTO_TEST_CASE(test_hard_example_unicode)
|
||||
#else
|
||||
BOOST_AUTO_TEST_CASE(test_hard_example_unicode)
|
||||
{
|
||||
const auto data = toml::parse(toml::test::file::hard_example_unicode);
|
||||
const auto data = toml::parse("toml/tests/hard_example_unicode.toml");
|
||||
|
||||
const auto the = toml::find<toml::table>(data, "the");
|
||||
BOOST_TEST(toml::get<std::string>(the.at("test_string")) ==
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <toml11/test/files.hpp>
|
||||
|
||||
template<typename Comment,
|
||||
template<typename ...> class Table,
|
||||
@ -47,7 +46,7 @@ bool has_comment_inside(const toml::basic_value<Comment, Table, Array>& v)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_example)
|
||||
{
|
||||
const auto data = toml::parse(toml::test::file::example);
|
||||
const auto data = toml::parse("toml/tests/example.toml");
|
||||
{
|
||||
std::ofstream ofs("tmp1.toml");
|
||||
ofs << std::setw(80) << data;
|
||||
@ -69,7 +68,7 @@ BOOST_AUTO_TEST_CASE(test_example)
|
||||
BOOST_AUTO_TEST_CASE(test_example_map_dq)
|
||||
{
|
||||
const auto data = toml::parse<toml::discard_comments, std::map, std::deque>(
|
||||
toml::test::file::example);
|
||||
"toml/tests/example.toml");
|
||||
{
|
||||
std::ofstream ofs("tmp1_map_dq.toml");
|
||||
ofs << std::setw(80) << data;
|
||||
@ -91,7 +90,7 @@ BOOST_AUTO_TEST_CASE(test_example_map_dq)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_example_with_comment)
|
||||
{
|
||||
const auto data = toml::parse<toml::preserve_comments>(toml::test::file::example);
|
||||
const auto data = toml::parse<toml::preserve_comments>("toml/tests/example.toml");
|
||||
{
|
||||
std::ofstream ofs("tmp1_com.toml");
|
||||
ofs << std::setw(80) << data;
|
||||
@ -117,7 +116,7 @@ BOOST_AUTO_TEST_CASE(test_example_with_comment)
|
||||
BOOST_AUTO_TEST_CASE(test_example_with_comment_nocomment)
|
||||
{
|
||||
{
|
||||
const auto data = toml::parse<toml::preserve_comments>(toml::test::file::example);
|
||||
const auto data = toml::parse<toml::preserve_comments>("toml/tests/example.toml");
|
||||
{
|
||||
std::ofstream ofs("tmp1_com_nocomment.toml");
|
||||
ofs << std::setw(80) << toml::nocomment << data;
|
||||
@ -127,7 +126,7 @@ BOOST_AUTO_TEST_CASE(test_example_with_comment_nocomment)
|
||||
BOOST_TEST(!has_comment_inside(serialized));
|
||||
}
|
||||
{
|
||||
const auto data_nocomment = toml::parse(toml::test::file::example);
|
||||
const auto data_nocomment = toml::parse("toml/tests/example.toml");
|
||||
auto serialized = toml::parse("tmp1_com_nocomment.toml");
|
||||
{
|
||||
auto& owner = toml::find(serialized, "owner");
|
||||
@ -146,7 +145,7 @@ BOOST_AUTO_TEST_CASE(test_example_with_comment_nocomment)
|
||||
BOOST_AUTO_TEST_CASE(test_example_with_comment_map_dq)
|
||||
{
|
||||
const auto data = toml::parse<toml::preserve_comments, std::map, std::deque>(
|
||||
toml::test::file::example);
|
||||
"toml/tests/example.toml");
|
||||
{
|
||||
std::ofstream ofs("tmp1_com_map_dq.toml");
|
||||
ofs << std::setw(80) << data;
|
||||
@ -173,8 +172,7 @@ BOOST_AUTO_TEST_CASE(test_example_with_comment_map_dq)
|
||||
BOOST_AUTO_TEST_CASE(test_example_with_comment_map_dq_nocomment)
|
||||
{
|
||||
{
|
||||
const auto data = toml::parse<toml::preserve_comments, std::map, std::deque>(
|
||||
toml::test::file::example);
|
||||
const auto data = toml::parse<toml::preserve_comments, std::map, std::deque>("toml/tests/example.toml");
|
||||
{
|
||||
std::ofstream ofs("tmp1_com_map_dq_nocomment.toml");
|
||||
ofs << std::setw(80) << toml::nocomment << data;
|
||||
@ -183,7 +181,7 @@ BOOST_AUTO_TEST_CASE(test_example_with_comment_map_dq_nocomment)
|
||||
BOOST_TEST(!has_comment_inside(serialized));
|
||||
}
|
||||
{
|
||||
const auto data_nocomment = toml::parse(toml::test::file::example);
|
||||
const auto data_nocomment = toml::parse("toml/tests/example.toml");
|
||||
auto serialized = toml::parse("tmp1_com_map_dq_nocomment.toml");
|
||||
{
|
||||
auto& owner = toml::find(serialized, "owner");
|
||||
@ -200,7 +198,7 @@ BOOST_AUTO_TEST_CASE(test_example_with_comment_map_dq_nocomment)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_fruit)
|
||||
{
|
||||
const auto data = toml::parse(toml::test::file::fruit);
|
||||
const auto data = toml::parse("toml/tests/fruit.toml");
|
||||
{
|
||||
std::ofstream ofs("tmp2.toml");
|
||||
ofs << std::setw(80) << data;
|
||||
@ -212,7 +210,7 @@ BOOST_AUTO_TEST_CASE(test_fruit)
|
||||
BOOST_AUTO_TEST_CASE(test_fruit_map_dq)
|
||||
{
|
||||
const auto data = toml::parse<toml::discard_comments, std::map, std::deque>(
|
||||
toml::test::file::fruit);
|
||||
"toml/tests/fruit.toml");
|
||||
{
|
||||
std::ofstream ofs("tmp2.toml");
|
||||
ofs << std::setw(80) << data;
|
||||
@ -224,7 +222,7 @@ BOOST_AUTO_TEST_CASE(test_fruit_map_dq)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_fruit_with_comments)
|
||||
{
|
||||
const auto data = toml::parse<toml::preserve_comments>(toml::test::file::fruit);
|
||||
const auto data = toml::parse<toml::preserve_comments>("toml/tests/fruit.toml");
|
||||
{
|
||||
std::ofstream ofs("tmp2_com.toml");
|
||||
ofs << std::setw(80) << data;
|
||||
@ -236,7 +234,7 @@ BOOST_AUTO_TEST_CASE(test_fruit_with_comments)
|
||||
BOOST_AUTO_TEST_CASE(test_fruit_with_comments_map_dq)
|
||||
{
|
||||
const auto data = toml::parse<toml::preserve_comments, std::map, std::deque>(
|
||||
toml::test::file::fruit);
|
||||
"toml/tests/fruit.toml");
|
||||
{
|
||||
std::ofstream ofs("tmp2_com.toml");
|
||||
ofs << std::setw(80) << data;
|
||||
@ -247,7 +245,7 @@ BOOST_AUTO_TEST_CASE(test_fruit_with_comments_map_dq)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_hard_example)
|
||||
{
|
||||
const auto data = toml::parse(toml::test::file::hard_example);
|
||||
const auto data = toml::parse("toml/tests/hard_example.toml");
|
||||
{
|
||||
std::ofstream ofs("tmp3.toml");
|
||||
ofs << std::setw(80) << data;
|
||||
@ -259,7 +257,7 @@ BOOST_AUTO_TEST_CASE(test_hard_example)
|
||||
BOOST_AUTO_TEST_CASE(test_hard_example_map_dq)
|
||||
{
|
||||
const auto data = toml::parse<toml::discard_comments, std::map, std::deque>(
|
||||
toml::test::file::hard_example);
|
||||
"toml/tests/hard_example.toml");
|
||||
{
|
||||
std::ofstream ofs("tmp3.toml");
|
||||
ofs << std::setw(80) << data;
|
||||
@ -272,7 +270,7 @@ BOOST_AUTO_TEST_CASE(test_hard_example_map_dq)
|
||||
BOOST_AUTO_TEST_CASE(test_hard_example_with_comment)
|
||||
{
|
||||
const auto data = toml::parse<toml::preserve_comments, std::map, std::deque>(
|
||||
toml::test::file::hard_example);
|
||||
"toml/tests/hard_example.toml");
|
||||
{
|
||||
std::ofstream ofs("tmp3_com.toml");
|
||||
ofs << std::setw(80) << data;
|
||||
|
Loading…
Reference in New Issue
Block a user