|
|
@ -43,17 +43,17 @@ class LineLengthTestCase(RuleTestCase):
|
|
|
|
self.check('---\n', conf)
|
|
|
|
self.check('---\n', conf)
|
|
|
|
self.check(80 * 'a', conf)
|
|
|
|
self.check(80 * 'a', conf)
|
|
|
|
self.check('---\n' + 80 * 'a' + '\n', conf)
|
|
|
|
self.check('---\n' + 80 * 'a' + '\n', conf)
|
|
|
|
self.check(81 * 'a', conf, problem=(1, 81))
|
|
|
|
self.check(16 * 'aaaa ' + 'z', conf, problem=(1, 81))
|
|
|
|
self.check('---\n' + 81 * 'a' + '\n', conf, problem=(2, 81))
|
|
|
|
self.check('---\n' + 16 * 'aaaa ' + 'z' + '\n', conf, problem=(2, 81))
|
|
|
|
self.check(1000 * 'b', conf, problem=(1, 81))
|
|
|
|
self.check(1000 * 'word ' + 'end', conf, problem=(1, 81))
|
|
|
|
self.check('---\n' + 1000 * 'b' + '\n', conf, problem=(2, 81))
|
|
|
|
self.check('---\n' + 1000 * 'word ' + 'end\n', conf, problem=(2, 81))
|
|
|
|
|
|
|
|
|
|
|
|
def test_max_length_10(self):
|
|
|
|
def test_max_length_10(self):
|
|
|
|
conf = ('line-length: {max: 10}\n'
|
|
|
|
conf = ('line-length: {max: 10}\n'
|
|
|
|
'new-line-at-end-of-file: disable\n')
|
|
|
|
'new-line-at-end-of-file: disable\n')
|
|
|
|
self.check('---\nABCDEFGHIJ', conf)
|
|
|
|
self.check('---\nABCD EFGHI', conf)
|
|
|
|
self.check('---\nABCDEFGHIJK', conf, problem=(2, 11))
|
|
|
|
self.check('---\nABCD EFGHIJ', conf, problem=(2, 11))
|
|
|
|
self.check('---\nABCDEFGHIJK\n', conf, problem=(2, 11))
|
|
|
|
self.check('---\nABCD EFGHIJ\n', conf, problem=(2, 11))
|
|
|
|
|
|
|
|
|
|
|
|
def test_spaces(self):
|
|
|
|
def test_spaces(self):
|
|
|
|
conf = ('line-length: {max: 80}\n'
|
|
|
|
conf = ('line-length: {max: 80}\n'
|
|
|
@ -61,3 +61,36 @@ class LineLengthTestCase(RuleTestCase):
|
|
|
|
'trailing-spaces: disable\n')
|
|
|
|
'trailing-spaces: disable\n')
|
|
|
|
self.check('---\n' + 81 * ' ', conf, problem=(2, 81))
|
|
|
|
self.check('---\n' + 81 * ' ', conf, problem=(2, 81))
|
|
|
|
self.check('---\n' + 81 * ' ' + '\n', conf, problem=(2, 81))
|
|
|
|
self.check('---\n' + 81 * ' ' + '\n', conf, problem=(2, 81))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_non_breakable_word(self):
|
|
|
|
|
|
|
|
conf = 'line-length: {max: 20, allow-non-breakable-words: yes}'
|
|
|
|
|
|
|
|
self.check('---\n' + 30 * 'A' + '\n', conf)
|
|
|
|
|
|
|
|
self.check('---\n'
|
|
|
|
|
|
|
|
'this:\n'
|
|
|
|
|
|
|
|
' is:\n'
|
|
|
|
|
|
|
|
' - a:\n'
|
|
|
|
|
|
|
|
' http://localhost/very/long/url\n'
|
|
|
|
|
|
|
|
'...\n', conf)
|
|
|
|
|
|
|
|
self.check('---\n'
|
|
|
|
|
|
|
|
'this:\n'
|
|
|
|
|
|
|
|
' is:\n'
|
|
|
|
|
|
|
|
' - a:\n'
|
|
|
|
|
|
|
|
' # http://localhost/very/long/url\n'
|
|
|
|
|
|
|
|
' comment\n'
|
|
|
|
|
|
|
|
'...\n', conf)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
conf = 'line-length: {max: 20, allow-non-breakable-words: no}'
|
|
|
|
|
|
|
|
self.check('---\n' + 30 * 'A' + '\n', conf, problem=(2, 21))
|
|
|
|
|
|
|
|
self.check('---\n'
|
|
|
|
|
|
|
|
'this:\n'
|
|
|
|
|
|
|
|
' is:\n'
|
|
|
|
|
|
|
|
' - a:\n'
|
|
|
|
|
|
|
|
' http://localhost/very/long/url\n'
|
|
|
|
|
|
|
|
'...\n', conf, problem=(5, 21))
|
|
|
|
|
|
|
|
self.check('---\n'
|
|
|
|
|
|
|
|
'this:\n'
|
|
|
|
|
|
|
|
' is:\n'
|
|
|
|
|
|
|
|
' - a:\n'
|
|
|
|
|
|
|
|
' # http://localhost/very/long/url\n'
|
|
|
|
|
|
|
|
' comment\n'
|
|
|
|
|
|
|
|
'...\n', conf, problem=(5, 21))
|
|
|
|