summaryrefslogtreecommitdiff
path: root/test/command_callback/test_javalsp_command_callback.vader
blob: 122f409b955b5edd8f3088cf3897abdbda7a0441 (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
73
74
75
76
77
78
79
80

Before:
  call ale#assert#SetUpLinterTest('java', 'javalsp')

After:
  call ale#assert#TearDownLinterTest()

Execute(The javalsp callback should return the correct default value):
  AssertLinter '', ale#Escape('')

Execute(The javalsp java executable should be configurable):
  let b:ale_java_javalsp_executable = '/bin/foobar'

  AssertLinter '/bin/foobar', ale#Escape('/bin/foobar')

Execute(The javalsp callback should return backward compatible value):
  let b:ale_java_javalsp_executable = '/bin/java'
  let cmd = [
  \ ale#Escape('/bin/java'),
  \ '--add-exports jdk.compiler/com.sun.tools.javac.api=javacs',
  \ '--add-exports jdk.compiler/com.sun.tools.javac.code=javacs',
  \ '--add-exports jdk.compiler/com.sun.tools.javac.comp=javacs',
  \ '--add-exports jdk.compiler/com.sun.tools.javac.main=javacs',
  \ '--add-exports jdk.compiler/com.sun.tools.javac.tree=javacs',
  \ '--add-exports jdk.compiler/com.sun.tools.javac.model=javacs',
  \ '--add-exports jdk.compiler/com.sun.tools.javac.util=javacs',
  \ '--add-opens jdk.compiler/com.sun.tools.javac.api=javacs',
  \ '-m javacs/org.javacs.Main',
  \]
  AssertLinter '/bin/java', join(cmd, ' ')

Execute(The javalsp should have default config):
  AssertEqual
  \ {
  \   'java': {
  \     'classPath': [],
  \     'externalDependencies': []
  \   }
  \ },
  \ ale_linters#java#javalsp#Config(bufnr(''))

Execute(The javalsp should have default config if user sets empty hash):
  let b:ale_java_javalsp_config = {}

  AssertEqual
  \ {
  \   'java': {
  \     'classPath': [],
  \     'externalDependencies': []
  \   }
  \ },
  \ ale_linters#java#javalsp#Config(bufnr(''))

Execute(The javalsp should have add missing config):
  let b:ale_java_javalsp_config = { 'java': { 'classPath': ['aaa.jar'] } }

  AssertEqual
  \ {
  \   'java': {
  \     'classPath': ['aaa.jar'],
  \     'externalDependencies': []
  \   }
  \ },
  \ ale_linters#java#javalsp#Config(bufnr(''))

  let b:ale_java_javalsp_config =
  \ {
  \   'java': {
  \     'externalDependencies': ['unit-test:2.0.0']
  \   }
  \ }

  AssertEqual
  \ {
  \   'java': {
  \     'classPath': [],
  \     'externalDependencies': ['unit-test:2.0.0']
  \   }
  \ },
  \ ale_linters#java#javalsp#Config(bufnr(''))