Opened 8 years ago
Last modified 8 years ago
#10815 new Bugs
Boost 1.55 property_tree INFO parser does not round-trip for \t (tab)
Reported by: | Owned by: | Sebastian Redl | |
---|---|---|---|
Milestone: | To Be Determined | Component: | property_tree |
Version: | Boost 1.55.0 | Severity: | Problem |
Keywords: | property_tree INFO round-trip \t tab | Cc: |
Description
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; } }
Note:
See TracTickets
for help on using tickets.