Rules: comments: Fix bug when multi-line scalar
YAML content like the following one produced an error, because the
ScalarToken associated whose value is "this is plain text" ends at the
beginning of the 5th line (the one with the comment):
---
string: >
this is plain text
# comment
This commit is contained in:
@@ -131,3 +131,19 @@ class CommentsTestCase(RuleTestCase):
|
||||
' require-starting-space: yes\n'
|
||||
' min-spaces-from-content: 2\n')
|
||||
self.check('# comment\n', conf)
|
||||
|
||||
def test_multi_line_scalar(self):
|
||||
conf = ('comments:\n'
|
||||
' require-starting-space: yes\n'
|
||||
' min-spaces-from-content: 2\n'
|
||||
'trailing-spaces: disable\n')
|
||||
self.check('---\n'
|
||||
'string: >\n'
|
||||
' this is plain text\n'
|
||||
'\n'
|
||||
'# comment\n', conf)
|
||||
self.check('---\n'
|
||||
'- string: >\n'
|
||||
' this is plain text\n'
|
||||
' \n'
|
||||
' # comment\n', conf)
|
||||
|
||||
Reference in New Issue
Block a user