Skip to content

Commit

Permalink
Merge pull request #318 from PIG208/quickstart
Browse files Browse the repository at this point in the history
[fix] add map node properly
  • Loading branch information
biojppm committed Oct 10, 2022
2 parents a758fa7 + e92b432 commit 74c8031
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions samples/quickstart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,18 @@ void sample_quick_overview()
wroot.append_child() << ryml::key("newseq (serialized)") |= ryml::SEQ;
CHECK(root.num_children() == 7);
CHECK(root["newseq"].num_children() == 0);
CHECK(root["newseq"].is_seq());
CHECK(root["newseq (serialized)"].num_children() == 0);
CHECK(root["newseq (serialized)"].is_seq());
// adding a map node:
CHECK(root.num_children() == 7);
wroot["newmap"] |= ryml::MAP;
wroot.append_child() << ryml::key("newmap (serialized)") |= ryml::SEQ;
wroot.append_child() << ryml::key("newmap (serialized)") |= ryml::MAP;
CHECK(root.num_children() == 9);
CHECK(root["newmap"].num_children() == 0);
CHECK(root["newmap"].is_map());
CHECK(root["newmap (serialized)"].num_children() == 0);
CHECK(root["newmap (serialized)"].is_map());
//
// When the tree is mutable, operator[] does not mutate the tree
// until the returned node is written to.
Expand Down Expand Up @@ -523,7 +527,7 @@ newkeyval (serialized): shiny and new (serialized)
newseq: []
newseq (serialized): []
newmap: {}
newmap (serialized): []
newmap (serialized): {}
I am something: indeed
)";
CHECK(buf_result == expected_result);
Expand Down

0 comments on commit 74c8031

Please sign in to comment.