Skip to content

Commit

Permalink
new(test): added a test to avoid future issues with LoadAll().
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP committed Sep 13, 2024
1 parent 2297f2e commit 7e0c9e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/integration/node_spec_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,12 @@ TEST(NodeSpecTest, Ex7_24_FlowNodes) {
EXPECT_EQ("", doc[4].as<std::string>());
}

TEST(NodeSpecTest, Ex7_25_InfiniteLoopNodes) {
// Until yaml-cpp <= 0.8.0 this caused an infinite loop
std::vector<Node> docs = LoadAll(ex7_25);
EXPECT_EQ(0, docs.size());
}

TEST(NodeSpecTest, Ex8_1_BlockScalarHeader) {
Node doc = Load(ex8_1);
EXPECT_EQ(4, doc.size());
Expand Down
3 changes: 3 additions & 0 deletions test/specexamples.h
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,9 @@ const char *ex7_24 =
"- *anchor\n"
"- !!str";

const char *ex7_25 =
",";

const char *ex8_1 =
"- | # Empty header\n"
" literal\n"
Expand Down

0 comments on commit 7e0c9e0

Please sign in to comment.