Fixed emitting colon at end of scalar bug
This commit is contained in:
parent
99089bf218
commit
337cb553d0
@ -5,8 +5,8 @@ project (YAML_CPP)
|
|||||||
set(LIB_TYPE SHARED)
|
set(LIB_TYPE SHARED)
|
||||||
|
|
||||||
if(IPHONE)
|
if(IPHONE)
|
||||||
set(CMAKE_OSX_SYSROOT iphoneos4.0)
|
set(CMAKE_OSX_SYSROOT iphoneos4.2)
|
||||||
set(CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT))
|
set(CMAKE_OSX_ARCHITECTURES "armv6;armv7")
|
||||||
set(LIB_TYPE)
|
set(LIB_TYPE)
|
||||||
endif(IPHONE)
|
endif(IPHONE)
|
||||||
|
|
||||||
|
@ -58,7 +58,13 @@ namespace YAML
|
|||||||
template<>
|
template<>
|
||||||
inline bool RegEx::IsValidSource<StringCharSource>(const StringCharSource&source) const
|
inline bool RegEx::IsValidSource<StringCharSource>(const StringCharSource&source) const
|
||||||
{
|
{
|
||||||
return source || m_op == REGEX_EMPTY;
|
switch(m_op) {
|
||||||
|
case REGEX_MATCH:
|
||||||
|
case REGEX_RANGE:
|
||||||
|
return source;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Source>
|
template <typename Source>
|
||||||
|
@ -727,6 +727,21 @@ namespace Test
|
|||||||
desiredOutput = "--- !!binary \"\"";
|
desiredOutput = "--- !!binary \"\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ColonAtEndOfScalar(YAML::Emitter& out, std::string& desiredOutput)
|
||||||
|
{
|
||||||
|
out << "a:";
|
||||||
|
desiredOutput = "--- \"a:\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
void ColonAsScalar(YAML::Emitter& out, std::string& desiredOutput)
|
||||||
|
{
|
||||||
|
out << YAML::BeginMap;
|
||||||
|
out << YAML::Key << "apple" << YAML::Value << ":";
|
||||||
|
out << YAML::Key << "banana" << YAML::Value << ":";
|
||||||
|
out << YAML::EndMap;
|
||||||
|
desiredOutput = "---\napple: \":\"\nbanana: \":\"";
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// incorrect emitting
|
// incorrect emitting
|
||||||
|
|
||||||
@ -916,6 +931,8 @@ namespace Test
|
|||||||
RunEmitterTest(&Emitter::Binary, "binary", passed, total);
|
RunEmitterTest(&Emitter::Binary, "binary", passed, total);
|
||||||
RunEmitterTest(&Emitter::LongBinary, "long binary", passed, total);
|
RunEmitterTest(&Emitter::LongBinary, "long binary", passed, total);
|
||||||
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::ColonAsScalar, "colon as scalar", passed, total);
|
||||||
|
|
||||||
RunEmitterErrorTest(&Emitter::ExtraEndSeq, "extra EndSeq", passed, total);
|
RunEmitterErrorTest(&Emitter::ExtraEndSeq, "extra EndSeq", passed, total);
|
||||||
RunEmitterErrorTest(&Emitter::ExtraEndMap, "extra EndMap", passed, total);
|
RunEmitterErrorTest(&Emitter::ExtraEndMap, "extra EndMap", passed, total);
|
||||||
|
Loading…
Reference in New Issue
Block a user