This commit is contained in:
Azat Khuzhin 2025-01-26 11:25:23 +01:00 committed by GitHub
commit 87931e11e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -82,7 +82,7 @@ inline const RegEx& Utf8_ByteOrderMark() {
// actual tags
inline const RegEx& DocStart() {
static const RegEx e = RegEx("---") + (BlankOrBreak() | RegEx());
static const RegEx e = RegEx("---");
return e;
}
inline const RegEx& DocEnd() {

View File

@ -1682,5 +1682,15 @@ TEST_F(HandlerSpecTest, Ex8_22_BlockCollectionNodes) {
EXPECT_CALL(handler, OnDocumentEnd());
Parse(ex8_22);
}
TEST_F(HandlerSpecTest, InvalidDocStart1) {
EXPECT_THROW_PARSER_EXCEPTION(IgnoreParse("----\nbaz: 1"),
ErrorMsg::BLOCK_ENTRY);
}
TEST_F(HandlerSpecTest, InvalidDocStart2) {
EXPECT_THROW_PARSER_EXCEPTION(IgnoreParse("----\n# foo\nbaz: 1"),
ErrorMsg::BLOCK_ENTRY);
}
} // namespace
} // namespace YAML