summaryrefslogtreecommitdiff
path: root/test/linter/test_checkstyle.vader
blob: 8197e6b54885d57a0b439770f5f555e179932b6f (plain)
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
Before:
  call ale#assert#SetUpLinterTest('java', 'checkstyle')
  call ale#test#SetFilename('dummy.java')

After:
  call ale#assert#TearDownLinterTest()

Execute(The checkstyle callback should return the correct default value):
  AssertLinter 'checkstyle',
  \ ale#Escape('checkstyle')
  \ . ' -c ' . ale#Escape('/google_checks.xml')
  \ . ' %s'

Execute(The checkstyle executable should be configurable):
  let b:ale_java_checkstyle_executable = 'foobar'

  AssertLinter 'foobar',
  \ ale#Escape('foobar')
  \ . ' -c ' . ale#Escape('/google_checks.xml')
  \ . ' %s'

Execute(Custom options should be supported):
  let b:ale_java_checkstyle_options = '--foobar -cp -classpath /path/to/checkstyle-8.7-all.jar'

  AssertLinter 'checkstyle',
  \ ale#Escape('checkstyle')
  \ . ' --foobar -cp -classpath /path/to/checkstyle-8.7-all.jar'
  \ . ' -c ' . ale#Escape('/google_checks.xml')
  \ . ' %s'

Execute(configuration files set in _config should be supported):
  let b:ale_java_checkstyle_config = ale#path#Simplify(g:dir . '/../test-files/checkstyle/other_config.xml')

  AssertLinter 'checkstyle',
  \ ale#Escape('checkstyle')
  \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/checkstyle/other_config.xml'))
  \ . ' %s'

Execute(configuration files set in _options should be preferred over _config):
  let b:ale_java_checkstyle_config = '/foo.xml'
  let b:ale_java_checkstyle_options = '-c /bar.xml'

  AssertLinter 'checkstyle', ale#Escape('checkstyle') . ' -c /bar.xml %s'

  let b:ale_java_checkstyle_options = '-x -c /bar.xml'

  AssertLinter 'checkstyle', ale#Escape('checkstyle') . ' -x -c /bar.xml %s'

Execute(google_checks.xml should be used by default):
  call ale#test#SetFilename('../test-files/checkstyle/test.java')

  AssertLinter 'checkstyle',
  \ ale#Escape('checkstyle')
  \ . ' -c ' . ale#Escape('/google_checks.xml')
  \ . ' %s'

Execute(Other relative paths should be supported):
  let b:ale_java_checkstyle_config = '../test-files/checkstyle/other_config.xml'

  AssertLinter 'checkstyle',
  \ ale#Escape('checkstyle')
  \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/checkstyle/other_config.xml'))
  \ . ' %s'

  call ale#test#SetFilename('../test-files/checkstyle/test.java')

  let b:ale_java_checkstyle_config = 'other_config.xml'

  AssertLinter 'checkstyle',
  \ ale#Escape('checkstyle')
  \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/checkstyle/other_config.xml'))
  \ . ' %s'