mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Fixed emitter bug with colon at the end of a scalar in a flow collection
This commit is contained in:
@@ -149,7 +149,7 @@ namespace YAML
|
|||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
inline const RegEx& EndScalarInFlow() {
|
inline const RegEx& EndScalarInFlow() {
|
||||||
static const RegEx e = (RegEx(':') + (BlankOrBreak() || RegEx(",]}", REGEX_OR))) || RegEx(",?[]{}", REGEX_OR);
|
static const RegEx e = (RegEx(':') + (BlankOrBreak() || RegEx() || RegEx(",]}", REGEX_OR))) || RegEx(",?[]{}", REGEX_OR);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -790,6 +790,12 @@ namespace Test
|
|||||||
desiredOutput = "apple: \":\"\nbanana: \":\"";
|
desiredOutput = "apple: \":\"\nbanana: \":\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ColonAtEndOfScalarInFlow(YAML::Emitter& out, std::string& desiredOutput)
|
||||||
|
{
|
||||||
|
out << YAML::Flow << YAML::BeginMap << YAML::Key << "C:" << YAML::Value << "C:" << YAML::EndMap;
|
||||||
|
desiredOutput = "{\"C:\": \"C:\"}";
|
||||||
|
}
|
||||||
|
|
||||||
void BoolFormatting(YAML::Emitter& out, std::string& desiredOutput)
|
void BoolFormatting(YAML::Emitter& out, std::string& desiredOutput)
|
||||||
{
|
{
|
||||||
out << YAML::BeginSeq;
|
out << YAML::BeginSeq;
|
||||||
@@ -1068,6 +1074,7 @@ namespace Test
|
|||||||
RunEmitterTest(&Emitter::EmptyBinary, "empty binary", passed, total);
|
RunEmitterTest(&Emitter::EmptyBinary, "empty binary", passed, total);
|
||||||
RunEmitterTest(&Emitter::ColonAtEndOfScalar, "colon at end of scalar", passed, total);
|
RunEmitterTest(&Emitter::ColonAtEndOfScalar, "colon at end of scalar", passed, total);
|
||||||
RunEmitterTest(&Emitter::ColonAsScalar, "colon as scalar", passed, total);
|
RunEmitterTest(&Emitter::ColonAsScalar, "colon as scalar", passed, total);
|
||||||
|
RunEmitterTest(&Emitter::ColonAtEndOfScalarInFlow, "colon at end of scalar in flow", passed, total);
|
||||||
RunEmitterTest(&Emitter::BoolFormatting, "bool formatting", passed, total);
|
RunEmitterTest(&Emitter::BoolFormatting, "bool formatting", passed, total);
|
||||||
RunEmitterTest(&Emitter::DocStartAndEnd, "doc start and end", passed, total);
|
RunEmitterTest(&Emitter::DocStartAndEnd, "doc start and end", passed, total);
|
||||||
RunEmitterTest(&Emitter::ImplicitDocStart, "implicit doc start", passed, total);
|
RunEmitterTest(&Emitter::ImplicitDocStart, "implicit doc start", passed, total);
|
||||||
|
Reference in New Issue
Block a user