Skip to content

Commit a6db7e3

Browse files
authored
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`.
1 parent 669af4e commit a6db7e3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/exp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ inline const RegEx& Blank() {
3737
return e;
3838
}
3939
inline const RegEx& Break() {
40-
static const RegEx e = RegEx('\n') | RegEx("\r\n");
40+
static const RegEx e = RegEx('\n') | RegEx("\r");
4141
return e;
4242
}
4343
inline const RegEx& BlankOrBreak() {

test/integration/emitter_test.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,14 @@ TEST_F(EmitterTest, UserType) {
968968
ExpectEmit("- x: 5\n bar: hello\n- x: 3\n bar: goodbye");
969969
}
970970

971+
TEST_F(EmitterTest, UserType2) {
972+
out << BeginSeq;
973+
out << Foo(5, "\r");
974+
out << EndSeq;
975+
976+
ExpectEmit("- x: 5\n bar: \"\\r\"");
977+
}
978+
971979
TEST_F(EmitterTest, UserTypeInContainer) {
972980
std::vector<Foo> fv;
973981
fv.push_back(Foo(5, "hello"));

0 commit comments

Comments
 (0)