Skip to content

Commit

Permalink
chore(test): moved infiniteloop test to load_node_test suite.
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP authored and jbeder committed Oct 30, 2024
1 parent 29c59c0 commit c2bec4c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
7 changes: 7 additions & 0 deletions test/integration/load_node_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,13 @@ TEST(NodeTest, LoadCommaSeparatedStrings) {
EXPECT_THROW(Load(R"(,foo)"), ParserException);
}

TEST(NodeSpecTest, 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).
EXPECT_THROW(LoadAll(R"(,)"), ParserException);
}

struct NewLineStringsTestCase {
std::string input;
std::string expected_content;
Expand Down
7 changes: 0 additions & 7 deletions test/integration/node_spec_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,13 +941,6 @@ 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());
Expand Down
3 changes: 0 additions & 3 deletions test/specexamples.h
Original file line number Diff line number Diff line change
Expand Up @@ -687,9 +687,6 @@ 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 c2bec4c

Please sign in to comment.