fix: parse files with '\r' symbols as line ending correctly

This commit is contained in:
Simon Gene Gottlieb
2024-08-22 10:29:29 +02:00
committed by Jesse Beder
parent b38ac5b55f
commit ee9c4d19be
3 changed files with 35 additions and 1 deletions

View File

@@ -360,5 +360,21 @@ TEST(LoadNodeTest, BlockCRNLEncoded) {
EXPECT_EQ(1, node["followup"].as<int>());
}
TEST(LoadNodeTest, BlockCREncoded) {
Node node = Load(
"blockText: |\r"
" some arbitrary text \r"
" spanning some \r"
" lines, that are split \r"
" by CR and NL\r"
"followup: 1");
EXPECT_EQ(
"some arbitrary text \nspanning some \nlines, that are split \nby CR and "
"NL\n",
node["blockText"].as<std::string>());
EXPECT_EQ(1, node["followup"].as<int>());
}
} // namespace
} // namespace YAML