test: add case demonstrating bug

This commit is contained in:
Simon Gene Gottlieb
2026-02-17 15:09:37 +01:00
committed by Jesse Beder
parent 495cde635d
commit f3f123cea0

View File

@@ -368,13 +368,18 @@ TEST(NodeTest, LoadCommaSeparatedStrings) {
EXPECT_THROW(Load(R"(,foo)"), ParserException); EXPECT_THROW(Load(R"(,foo)"), ParserException);
} }
TEST(NodeSpecTest, InfiniteLoopNodes) { TEST(NodeTest, InfiniteLoopNodes) {
// Until yaml-cpp <= 0.8.0 this caused an infinite loop; // Until yaml-cpp <= 0.8.0 this caused an infinite loop;
// After, it triggers an exception (but LoadAll is smart enough to avoid // After, it triggers an exception (but LoadAll is smart enough to avoid
// the infinite loop in any case). // the infinite loop in any case).
EXPECT_THROW(LoadAll(R"(,)"), ParserException); EXPECT_THROW(LoadAll(R"(,)"), ParserException);
} }
TEST(NodeTest, MultipleDocuments) {
std::vector<Node> docs = LoadAll("\n---\n---\nA\n");
EXPECT_EQ(docs.size(), 2);
}
struct NewLineStringsTestCase { struct NewLineStringsTestCase {
std::string input; std::string input;
std::string expected_content; std::string expected_content;