document-end: Fix spurious "missing document end"

DocumentStartToken is preceded by DirectiveToken.
This commit is contained in:
Dimitri Papadopoulos
2023-06-24 15:42:50 +02:00
committed by Adrien Vergé
parent 7f2c071545
commit a68c3aa69e
2 changed files with 22 additions and 1 deletions

View File

@@ -71,3 +71,22 @@ class DocumentEndTestCase(RuleTestCase):
'---\n'
'third: document\n'
'...\n', conf, problem=(6, 1))
def test_directives(self):
conf = 'document-end: {present: true}'
self.check('%YAML 1.2\n'
'---\n'
'document: end\n'
'...\n', conf)
self.check('%YAML 1.2\n'
'%TAG ! tag:clarkevans.com,2002:\n'
'---\n'
'document: end\n'
'...\n', conf)
self.check('---\n'
'first: document\n'
'...\n'
'%YAML 1.2\n'
'---\n'
'second: document\n'
'...\n', conf)