reset node hasBegun flags at the EndedGroup method. Fix #902
This commit is contained in:
parent
97d1ae547c
commit
8c55a70548
@ -175,8 +175,11 @@ void EmitterState::EndedGroup(GroupType::value type) {
|
|||||||
// some global settings that we changed may have been overridden
|
// some global settings that we changed may have been overridden
|
||||||
// by a local setting we just popped, so we need to restore them
|
// by a local setting we just popped, so we need to restore them
|
||||||
m_globalModifiedSettings.restore();
|
m_globalModifiedSettings.restore();
|
||||||
|
|
||||||
ClearModifiedSettings();
|
ClearModifiedSettings();
|
||||||
|
m_hasAnchor = false;
|
||||||
|
m_hasTag = false;
|
||||||
|
m_hasNonContent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EmitterNodeType::value EmitterState::CurGroupNodeType() const {
|
EmitterNodeType::value EmitterState::CurGroupNodeType() const {
|
||||||
|
|||||||
@ -1212,6 +1212,42 @@ TEST_F(EmitterTest, NaN) {
|
|||||||
"bar: .nan");
|
"bar: .nan");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(EmitterTest, ComplexFlowSeqEmbeddingAMapWithNewLine) {
|
||||||
|
out << YAML::BeginMap;
|
||||||
|
|
||||||
|
out << YAML::Key << "NodeA" << YAML::Value << YAML::BeginMap;
|
||||||
|
out << YAML::Key << "k" << YAML::Value << YAML::Flow << YAML::BeginSeq;
|
||||||
|
out << YAML::BeginMap << YAML::Key << "i" << YAML::Value << 0 << YAML::EndMap
|
||||||
|
<< YAML::Newline;
|
||||||
|
out << YAML::BeginMap << YAML::Key << "i" << YAML::Value << 1 << YAML::EndMap
|
||||||
|
<< YAML::Newline;
|
||||||
|
out << YAML::EndSeq;
|
||||||
|
out << YAML::EndMap;
|
||||||
|
|
||||||
|
out << YAML::Key << "NodeB" << YAML::Value << YAML::BeginMap;
|
||||||
|
out << YAML::Key << "k" << YAML::Value << YAML::Flow << YAML::BeginSeq;
|
||||||
|
out << YAML::BeginMap << YAML::Key << "i" << YAML::Value << 0 << YAML::EndMap
|
||||||
|
<< YAML::Newline;
|
||||||
|
out << YAML::BeginMap << YAML::Key << "i" << YAML::Value << 1 << YAML::EndMap
|
||||||
|
<< YAML::Newline;
|
||||||
|
out << YAML::EndSeq;
|
||||||
|
out << YAML::EndMap;
|
||||||
|
|
||||||
|
out << YAML::EndMap;
|
||||||
|
|
||||||
|
ExpectEmit(
|
||||||
|
"NodeA:\n"
|
||||||
|
" k: [{i: 0},\n"
|
||||||
|
" {i: 1},\n"
|
||||||
|
" ]\n"
|
||||||
|
"NodeB:\n"
|
||||||
|
" k: [{i: 0},\n"
|
||||||
|
" {i: 1},\n"
|
||||||
|
" ]"
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
class EmitterErrorTest : public ::testing::Test {
|
class EmitterErrorTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
void ExpectEmitError(const std::string& expectedError) {
|
void ExpectEmitError(const std::string& expectedError) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user