mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-08 12:21:17 +00:00
fix issue752: generate right long keys (#879)
* fix issue752: generate right long keys * Improve the readability of test cases * update to raw string literal
This commit is contained in:
@@ -686,6 +686,52 @@ TEST_F(EmitterTest, SimpleGlobalSettings) {
|
||||
ExpectEmit("- ? key 1\n : value 1\n ? key 2\n : [a, b, c]");
|
||||
}
|
||||
|
||||
TEST_F(EmitterTest, GlobalLongKeyOnSeq) {
|
||||
out.SetMapFormat(LongKey);
|
||||
|
||||
out << BeginMap;
|
||||
out << Key << Anchor("key");
|
||||
out << BeginSeq << "a"
|
||||
<< "b" << EndSeq;
|
||||
out << Value << Anchor("value");
|
||||
out << BeginSeq << "c"
|
||||
<< "d" << EndSeq;
|
||||
out << Key << Alias("key") << Value << Alias("value");
|
||||
out << EndMap;
|
||||
|
||||
ExpectEmit(R"(? &key
|
||||
- a
|
||||
- b
|
||||
: &value
|
||||
- c
|
||||
- d
|
||||
? *key
|
||||
: *value)");
|
||||
}
|
||||
|
||||
TEST_F(EmitterTest, GlobalLongKeyOnMap) {
|
||||
out.SetMapFormat(LongKey);
|
||||
|
||||
out << BeginMap;
|
||||
out << Key << Anchor("key");
|
||||
out << BeginMap << "a"
|
||||
<< "b" << EndMap;
|
||||
out << Value << Anchor("value");
|
||||
out << BeginMap << "c"
|
||||
<< "d" << EndMap;
|
||||
out << Key << Alias("key") << Value << Alias("value");
|
||||
out << EndMap;
|
||||
|
||||
ExpectEmit(R"(? &key
|
||||
? a
|
||||
: b
|
||||
: &value
|
||||
? c
|
||||
: d
|
||||
? *key
|
||||
: *value)");
|
||||
}
|
||||
|
||||
TEST_F(EmitterTest, ComplexGlobalSettings) {
|
||||
out << BeginSeq;
|
||||
out << Block;
|
||||
|
Reference in New Issue
Block a user