mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
Implemented binary emitting without the binary tag
This commit is contained in:
@@ -708,6 +708,24 @@ namespace Test
|
||||
out << YAML::EndSeq;
|
||||
desiredOutput = "---\n- a\n\n-\n - b\n - c\n\n\n-\n\n d: e\n ? f\n\n : foo";
|
||||
}
|
||||
|
||||
void Binary(YAML::Emitter& out, std::string& desiredOutput)
|
||||
{
|
||||
out << YAML::Binary("Hello, World!", 13);
|
||||
desiredOutput = "--- !!binary \"SGVsbG8sIFdvcmxkIQ==\"";
|
||||
}
|
||||
|
||||
void LongBinary(YAML::Emitter& out, std::string& desiredOutput)
|
||||
{
|
||||
out << YAML::Binary("Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.\n", 270);
|
||||
desiredOutput = "--- !!binary \"TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4K\"";
|
||||
}
|
||||
|
||||
void EmptyBinary(YAML::Emitter& out, std::string& desiredOutput)
|
||||
{
|
||||
out << YAML::Binary("", 0);
|
||||
desiredOutput = "--- !!binary \"\"";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// incorrect emitting
|
||||
@@ -895,6 +913,9 @@ namespace Test
|
||||
RunEmitterTest(&Emitter::NewlineInBlockMap, "newline in block map", passed, total);
|
||||
RunEmitterTest(&Emitter::NewlineInFlowMap, "newline in flow map", passed, total);
|
||||
RunEmitterTest(&Emitter::LotsOfNewlines, "lots of newlines", passed, total);
|
||||
RunEmitterTest(&Emitter::Binary, "binary", passed, total);
|
||||
RunEmitterTest(&Emitter::LongBinary, "long binary", passed, total);
|
||||
RunEmitterTest(&Emitter::EmptyBinary, "empty binary", passed, total);
|
||||
|
||||
RunEmitterErrorTest(&Emitter::ExtraEndSeq, "extra EndSeq", passed, total);
|
||||
RunEmitterErrorTest(&Emitter::ExtraEndMap, "extra EndMap", passed, total);
|
||||
|
Reference in New Issue
Block a user