Feat/fix faulty string (#1406)

This commit is contained in:
Simon Gene Gottlieb
2026-02-18 21:45:23 +01:00
committed by GitHub
parent 44d54544b1
commit 97d150e98b
3 changed files with 22 additions and 2 deletions

View File

@@ -375,11 +375,21 @@ TEST(NodeTest, InfiniteLoopNodes) {
EXPECT_THROW(LoadAll(R"(,)"), ParserException);
}
TEST(NodeTest, MultipleDocuments) {
TEST(NodeTest, MultipleDocumentsBeginning) {
std::vector<Node> docs = LoadAll("\n---\n---\nA\n");
EXPECT_EQ(docs.size(), 2);
}
TEST(NodeTest, MultipleDocumentsEnds) {
std::vector<Node> docs = LoadAll("\n...\nA\n...\n");
EXPECT_EQ(docs.size(), 2);
}
TEST(NodeTest, MultipleDocumentsEndsWithEmptyDocs) {
std::vector<Node> docs = LoadAll("\n...\nA\n...\n...\nB\n...");
EXPECT_EQ(docs.size(), 4);
}
struct NewLineStringsTestCase {
std::string input;
std::string expected_content;
@@ -451,6 +461,10 @@ TEST(LoadNodeTest, BlockCREncoded) {
EXPECT_EQ(1, node["followup"].as<int>());
}
TEST(LoadNodeTest, IncorrectSeqEnd) {
EXPECT_THROW(Load("[foo]_bar"), ParserException);
}
} // namespace
} // namespace YAML