Prevent trailing spaces when emitting literal strings (#1005)

This commit is contained in:
theamarin
2021-07-05 05:30:04 +02:00
committed by GitHub
parent a6bbe0e50a
commit 9ee3928754
2 changed files with 16 additions and 2 deletions

View File

@@ -382,6 +382,20 @@ TEST_F(EmitterTest, ScalarFormat) {
"crazy\tsymbols that we like");
}
TEST_F(EmitterTest, LiteralWithoutTrailingSpaces) {
out << YAML::BeginMap;
out << YAML::Key << "key";
out << YAML::Value << YAML::Literal;
out << "expect that with two newlines\n\n"
"no spaces are emitted in the empty line";
out << YAML::EndMap;
ExpectEmit(
"key: |\n"
" expect that with two newlines\n\n"
" no spaces are emitted in the empty line");
}
TEST_F(EmitterTest, AutoLongKeyScalar) {
out << BeginMap;
out << Key << Literal << "multi-line\nscalar";