Subject: [Boost-bugs] [Boost C++ Libraries] #10815: Boost 1.55 property_tree INFO parser does not round-trip for \t (tab)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-11-24 21:12:25
#10815: Boost 1.55 property_tree INFO parser does not round-trip for \t (tab)
-------------------------+-------------------------------------------------
Reporter: brewmanz | Type: Bugs
<brewmanz@â¦> | Milestone: To Be Determined
Status: new | Version: Boost 1.55.0
Component: None | Keywords: property_tree INFO round-trip \t
Severity: Problem | tab
-------------------------+-------------------------------------------------
Following GTest fails, as embedded tab (\t) has been expanded to a 'real
tab' by write_info (note that \n, \0, \r are all escaped properly
{{{
TEST(AdHocTest, AHT0051Boost__property_tree__info_parser_tab)
{
std::stringstream ss;
std::string inputRaw, input, output, exp, act;
boost::property_tree::ptree ptree;
inputRaw = "key2 \"value with special characters in it {};
#\\n\\t\\\"\\r\"\n";
ss.str(inputRaw);
ASSERT_NO_THROW(boost::property_tree::info_parser::read_info(ss, ptree))
<< "parse inputRaw";
EXPECT_EQ(std::string("value with special characters in it
{}; #\n\t\"\r"), ptree.get<std::string>("key2"));
ss = std::stringstream();
ASSERT_NO_THROW(boost::property_tree::info_parser::write_info(ss, ptree))
<< "extract input";
input = ss.str();
exp = "key2 \"value with special characters in it {};
#\\n\\t\\\"\\r\"\n";
act = input;
EXPECT_EQ(exp.size(), act.size());
EXPECT_EQ(exp, act);
for (size_t ix = 0, diffs = 0; (ix < exp.size()) && (ix <
act.size()) && (diffs < 5); ++ix)
{
if (exp[ix] != act[ix]) { ++diffs; }
EXPECT_EQ(exp[ix], act[ix]) << "ix=" << ix;
}
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10815> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC