From 0fc0967f6f9b36dc3bc839a876b7b6a9b11427ce Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Sat, 29 Jun 2019 15:38:28 +0900 Subject: [PATCH] fix: remove CR before comparing to the reference --- tests/test_serialize_file.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/test_serialize_file.cpp b/tests/test_serialize_file.cpp index e0ab10d..f7384bb 100644 --- a/tests/test_serialize_file.cpp +++ b/tests/test_serialize_file.cpp @@ -127,7 +127,16 @@ BOOST_AUTO_TEST_CASE(test_example_with_comment_nocomment) } { const auto data_nocomment = toml::parse("toml/tests/example.toml"); - const auto serialized = toml::parse("tmp1_com_nocomment.toml"); + auto serialized = toml::parse("tmp1_com_nocomment.toml"); + { + auto& owner = toml::find(serialized, "owner"); + auto& bio = toml::find(owner, "bio"); + const auto CR = std::find(bio.begin(), bio.end(), '\r'); + if(CR != bio.end()) + { + bio.erase(CR); + } + } // check collectly serialized BOOST_TEST(data_nocomment == serialized); } @@ -173,7 +182,16 @@ BOOST_AUTO_TEST_CASE(test_example_with_comment_map_dq_nocomment) } { const auto data_nocomment = toml::parse("toml/tests/example.toml"); - const auto serialized = toml::parse("tmp1_com_map_dq_nocomment.toml"); + auto serialized = toml::parse("tmp1_com_map_dq_nocomment.toml"); + { + auto& owner = toml::find(serialized, "owner"); + auto& bio = toml::find(owner, "bio"); + const auto CR = std::find(bio.begin(), bio.end(), '\r'); + if(CR != bio.end()) + { + bio.erase(CR); + } + } BOOST_TEST(data_nocomment == serialized); } }