diff --git a/src/exp.h b/src/exp.h index c623ec9..a0d6d76 100644 --- a/src/exp.h +++ b/src/exp.h @@ -37,7 +37,7 @@ inline const RegEx& Blank() { return e; } inline const RegEx& Break() { - static const RegEx e = RegEx('\n') | RegEx("\r"); + static const RegEx e = RegEx('\n') | RegEx("\r\n") | RegEx('\r'); return e; } inline const RegEx& BlankOrBreak() { diff --git a/test/integration/load_node_test.cpp b/test/integration/load_node_test.cpp index 958e735..9d0c790 100644 --- a/test/integration/load_node_test.cpp +++ b/test/integration/load_node_test.cpp @@ -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()); + EXPECT_EQ(1, node["followup"].as()); +} + } // namespace } // namespace YAML