mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-08 12:21:17 +00:00
@@ -430,6 +430,21 @@ TEST_F(EmitterTest, AliasAndAnchor) {
|
||||
ExpectEmit("- &fred\n name: Fred\n age: 42\n- *fred");
|
||||
}
|
||||
|
||||
TEST_F(EmitterTest, AliasOnKey) {
|
||||
out << BeginSeq;
|
||||
out << Anchor("name") << "Name";
|
||||
out << BeginMap;
|
||||
out << Key << Alias("name") << Value << "Fred";
|
||||
out << EndMap;
|
||||
out << Flow << BeginMap;
|
||||
out << Key << Alias("name") << Value << "Mike";
|
||||
out << EndMap;
|
||||
out << EndSeq;
|
||||
ExpectEmit(R"(- &name Name
|
||||
- *name : Fred
|
||||
- {*name : Mike})");
|
||||
}
|
||||
|
||||
TEST_F(EmitterTest, AliasAndAnchorWithNull) {
|
||||
out << BeginSeq;
|
||||
out << Anchor("fred") << Null;
|
||||
|
Reference in New Issue
Block a user