Add test showing the issue of #1098.

Regression reported in #1098 is caused by block values not consuming Breaks in
CRNL encoded input data correctly.
This commit is contained in:
Andre Vehreschild 2022-04-19 18:43:54 +02:00
parent 7d06655611
commit 730f4ba826

View File

@ -345,5 +345,20 @@ TEST(NodeTest, LoadTagWithNullScalar) {
EXPECT_TRUE(node.IsNull());
}
TEST(LoadNodeTest, BlockCRNLEncoded) {
Node node = Load(
"blockText: |\r\n"
" some arbitrary text \r\n"
" spanning some \r\n"
" lines, that are split \r\n"
" by CR and NL\r\n"
"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