diff --git a/test/integration/node_spec_test.cpp b/test/integration/node_spec_test.cpp index bfc8578..1754ee9 100644 --- a/test/integration/node_spec_test.cpp +++ b/test/integration/node_spec_test.cpp @@ -941,6 +941,13 @@ TEST(NodeSpecTest, Ex7_24_FlowNodes) { EXPECT_EQ("", doc[4].as()); } +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()); diff --git a/test/specexamples.h b/test/specexamples.h index 46e2c4c..ebe62e5 100644 --- a/test/specexamples.h +++ b/test/specexamples.h @@ -687,6 +687,9 @@ const char *ex7_24 = "- *anchor\n" "- !!str"; +const char *ex7_25 = + ","; + const char *ex8_1 = "- | # Empty header\n" " literal\n"