line_length: tweak tests
This commit is contained in:
@@ -120,11 +120,22 @@ class LineLengthTestCase(RuleTestCase):
|
|||||||
self.check('---\n'
|
self.check('---\n'
|
||||||
'# http://www.verylongurlurlurlurlurlurlurlurl.com\n'
|
'# http://www.verylongurlurlurlurlurlurlurlurl.com\n'
|
||||||
'key:\n'
|
'key:\n'
|
||||||
' value:\n', conf)
|
' subkey: value\n', conf)
|
||||||
self.check('---\n'
|
self.check('---\n'
|
||||||
'## http://www.verylongurlurlurlurlurlurlurlurl.com\n'
|
'## http://www.verylongurlurlurlurlurlurlurlurl.com\n'
|
||||||
'key:\n'
|
'key:\n'
|
||||||
' value:\n', conf)
|
' subkey: value\n', conf)
|
||||||
|
self.check('---\n'
|
||||||
|
'# # http://www.verylongurlurlurlurlurlurlurlurl.com\n'
|
||||||
|
'key:\n'
|
||||||
|
' subkey: value\n', conf,
|
||||||
|
problem=(2, 21))
|
||||||
|
self.check('---\n'
|
||||||
|
'#A http://www.verylongurlurlurlurlurlurlurlurl.com\n'
|
||||||
|
'key:\n'
|
||||||
|
' subkey: value\n', conf,
|
||||||
|
problem1=(2, 2, 'comments'),
|
||||||
|
problem2=(2, 21, 'line-length'))
|
||||||
|
|
||||||
conf = ('line-length: {max: 20, allow-non-breakable-words: true}\n'
|
conf = ('line-length: {max: 20, allow-non-breakable-words: true}\n'
|
||||||
'trailing-spaces: disable')
|
'trailing-spaces: disable')
|
||||||
|
|||||||
@@ -140,11 +140,11 @@ def check(conf, line):
|
|||||||
start += 1
|
start += 1
|
||||||
|
|
||||||
if start != line.end:
|
if start != line.end:
|
||||||
if line.buffer[start] in ('#'):
|
if line.buffer[start] == '#':
|
||||||
idx = line.buffer.find(' ', start, line.end)
|
while line.buffer[start] == '#':
|
||||||
if idx != -1:
|
start += 1
|
||||||
start = idx + 1
|
start += 1
|
||||||
elif line.buffer[start] in ('-'):
|
elif line.buffer[start] == '-':
|
||||||
start += 2
|
start += 2
|
||||||
|
|
||||||
if line.buffer.find(' ', start, line.end) == -1:
|
if line.buffer.find(' ', start, line.end) == -1:
|
||||||
|
|||||||
Reference in New Issue
Block a user