new(test): added a test to avoid future issues with LoadAll().

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
This commit is contained in:
Federico Di Pierro
2024-09-13 08:58:51 +02:00
committed by Jesse Beder
parent bc67157109
commit 29c59c01d4
2 changed files with 10 additions and 0 deletions

View File

@@ -941,6 +941,13 @@ 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;
// After, it triggers an exception (but LoadAll is smart enough to avoid
// the infinite loop in any case).
ASSERT_THROW(LoadAll(ex7_25), ParserException);
}
TEST(NodeSpecTest, Ex8_1_BlockScalarHeader) {
Node doc = Load(ex8_1);
EXPECT_EQ(4, doc.size());

View File

@@ -687,6 +687,9 @@ const char *ex7_24 =
"- *anchor\n"
"- !!str";
const char *ex7_25 =
",";
const char *ex8_1 =
"- | # Empty header\n"
" literal\n"