From d0250400496b6ac61f672bdad116c36c24383dd8 Mon Sep 17 00:00:00 2001 From: butataatawa Date: Fri, 2 Dec 2016 15:58:48 +0100 Subject: [PATCH] Fix input strings with quotes giving "!" tagging artifacts. --- src/emitfromevents.cpp | 2 +- test/integration/emitter_test.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/emitfromevents.cpp b/src/emitfromevents.cpp index 45c5b99..4832649 100644 --- a/src/emitfromevents.cpp +++ b/src/emitfromevents.cpp @@ -111,7 +111,7 @@ void EmitFromEvents::BeginNode() { } void EmitFromEvents::EmitProps(const std::string& tag, anchor_t anchor) { - if (!tag.empty() && tag != "?") + if (!tag.empty() && tag != "?" && tag != "!") m_emitter << VerbatimTag(tag); if (anchor) m_emitter << Anchor(ToString(anchor)); diff --git a/test/integration/emitter_test.cpp b/test/integration/emitter_test.cpp index 6ce1667..2780838 100644 --- a/test/integration/emitter_test.cpp +++ b/test/integration/emitter_test.cpp @@ -46,6 +46,12 @@ TEST_F(EmitterTest, SimpleScalar) { ExpectEmit("Hello, World!"); } +TEST_F(EmitterTest, SimpleQuotedScalar) { + Node n(Load("\"test\"")); + out << n; + ExpectEmit("test"); +} + TEST_F(EmitterTest, SimpleSeq) { out << BeginSeq; out << "eggs";