forked from coala/coala-bears
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LineLengthBearTest.py
75 lines (60 loc) · 1.9 KB
/
LineLengthBearTest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from bears.general.LineLengthBear import LineLengthBear
from coalib.testing.LocalBearTestHelper import verify_local_bear
from coalib.bearlib.aspects import (
AspectList,
get as get_aspect,
)
test_file = """
test
too
er
e
"""
invalid_general_file = 'C' * (79 + 1)
invalid_VB_file = 'C' * (65535 + 1)
LineLengthBearTest = verify_local_bear(LineLengthBear,
valid_files=(test_file,),
invalid_files=('testa',
'test line'),
settings={'max_line_length': '4'})
LineLengthBearIgnoreRegexTest = verify_local_bear(
LineLengthBear,
valid_files=(test_file,
'http://a.domain.de',
'ftp://a.domain.de',
'hi there ftp://!'),
invalid_files=('http not a link',),
settings={
'max_line_length': '4',
'ignore_length_regex': 'http://, https://, ftp://'})
LineLengthBearLangSpecificLineLengthTest = verify_local_bear(
LineLengthBear,
valid_files=(test_file,),
invalid_files=(invalid_VB_file,),
settings={'language': 'VisualBasic'},
)
LineLengthBearValidLanguageTest = verify_local_bear(
LineLengthBear,
valid_files=(test_file,),
invalid_files=(invalid_general_file,),
settings={'language': 'C'},
)
LineLengthBearAspectTest = verify_local_bear(
LineLengthBear,
valid_files=(test_file,),
invalid_files=('testa',
'test line'),
aspects=AspectList([
get_aspect('LineLength')('Unknown', max_line_length=4),
]),
)
SettingsOverAspectsPriorityTest = verify_local_bear(
LineLengthBear,
valid_files=(test_file,),
invalid_files=('testa',
'test line'),
aspects=AspectList([
get_aspect('LineLength')('Unknown', max_line_length=10),
]),
settings={'max_line_length': '4'},
)