Unverified Commit a6db7e32 authored by Dr. Andre Vehreschild's avatar Dr. Andre Vehreschild Committed by GitHub
Browse files

Fix single cr not recognized (#1094)

Complies with YAML Standard [5.4](https://yaml.org/spec/1.2.2/#54-line-break-characters) [25] instead of matching `\r` only in combination with `\n`.
parent 669af4eb
...@@ -37,7 +37,7 @@ inline const RegEx& Blank() { ...@@ -37,7 +37,7 @@ inline const RegEx& Blank() {
return e; return e;
} }
inline const RegEx& Break() { inline const RegEx& Break() {
static const RegEx e = RegEx('\n') | RegEx("\r\n"); static const RegEx e = RegEx('\n') | RegEx("\r");
return e; return e;
} }
inline const RegEx& BlankOrBreak() { inline const RegEx& BlankOrBreak() {
......
...@@ -968,6 +968,14 @@ TEST_F(EmitterTest, UserType) { ...@@ -968,6 +968,14 @@ TEST_F(EmitterTest, UserType) {
ExpectEmit("- x: 5\n bar: hello\n- x: 3\n bar: goodbye"); ExpectEmit("- x: 5\n bar: hello\n- x: 3\n bar: goodbye");
} }
TEST_F(EmitterTest, UserType2) {
out << BeginSeq;
out << Foo(5, "\r");
out << EndSeq;
ExpectEmit("- x: 5\n bar: \"\\r\"");
}
TEST_F(EmitterTest, UserTypeInContainer) { TEST_F(EmitterTest, UserTypeInContainer) {
std::vector<Foo> fv; std::vector<Foo> fv;
fv.push_back(Foo(5, "hello")); fv.push_back(Foo(5, "hello"));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment