From 961e4aede935e51466f487b7fe0d804b761218e0 Mon Sep 17 00:00:00 2001 From: theamarin Date: Sun, 4 Jul 2021 10:44:25 +0200 Subject: [PATCH] Move emitter test for trailing spaces in literals to integration test --- test/integration/emitter_test.cpp | 14 ++++++++++++++ test/node/node_test.cpp | 12 ------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/test/integration/emitter_test.cpp b/test/integration/emitter_test.cpp index 66198a6..e65c011 100644 --- a/test/integration/emitter_test.cpp +++ b/test/integration/emitter_test.cpp @@ -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::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"; diff --git a/test/node/node_test.cpp b/test/node/node_test.cpp index ac6c785..4f577c8 100644 --- a/test/node/node_test.cpp +++ b/test/node/node_test.cpp @@ -769,17 +769,5 @@ TEST_F(NodeEmitterTest, NestFlowMapListNode) { ExpectOutput("{position: [1.5, 2.25, 3.125]}", mapNode); } - -TEST_F(NodeEmitterTest, LiteralWithoutTrailingSpaces) { - YAML::Emitter emitter; - emitter << YAML::BeginMap; - emitter << YAML::Key << "key"; - emitter << YAML::Literal; - emitter << "value\n\nwith newlines"; - emitter << YAML::EndMap; - - ASSERT_TRUE(emitter.good()); - EXPECT_STREQ("key: |\n value\n\n with newlines", emitter.c_str()); -} } }