]> git.madduck.net Git - etc/vim.git/blob - test/linter/test_eclipselsp.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / test / linter / test_eclipselsp.vader
1 Before:
2   call ale#assert#SetUpLinterTest('java', 'eclipselsp')
3   call ale#test#SetFilename('dummy.java')
4
5   let b:ale_java_eclipselsp_path = '/home/user/eclipse.dst.ls'
6
7   if has('win32')
8     let b:cfg = ale#path#Simplify(g:dir . '/../config_win')
9   elseif has('macunix')
10     let b:cfg = ale#path#Simplify(g:dir . '/../config_mac')
11   else
12     let b:cfg = ale#path#Simplify(g:dir . '/../config_linux')
13   endif
14
15 After:
16   unlet! b:ale_java_eclipselsp_path
17   unlet! b:cfg
18
19   call ale#assert#TearDownLinterTest()
20
21 Execute(VersionCheck should return correct version):
22
23   " OpenJDK Java 1.8
24   AssertEqual [1, 8, 0], ale_linters#java#eclipselsp#VersionCheck([
25   \ 'openjdk version "1.8.0_191"',
26   \ 'OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-0ubuntu0.18.04.1-b12)',
27   \ 'OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)'
28   \])
29
30   " OpenJDK Java 10
31   AssertEqual [10, 0, 2], ale_linters#java#eclipselsp#VersionCheck([
32   \ 'openjdk version "10.0.2" 2018-07-17',
33   \ 'OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)',
34   \ 'OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)'
35   \])
36
37   " Oracle Java 1.8
38   AssertEqual [1, 8, 0], ale_linters#java#eclipselsp#VersionCheck([
39   \ 'java version "1.8.0_161"',
40   \ 'Java(TM) SE Runtime Environment (build 1.8.0_161-b12)',
41   \ 'Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)'
42   \])
43
44   " Oracle Java 10
45   AssertEqual [10, 0, 1], ale_linters#java#eclipselsp#VersionCheck([
46   \ 'java version "10.0.1" 2018-04-17',
47   \ 'Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)',
48   \ 'Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)'
49   \])
50
51   AssertEqual [], ale_linters#java#eclipselsp#VersionCheck(['x'])
52
53   AssertEqual [], ale_linters#java#eclipselsp#VersionCheck([])
54
55 Execute(The eclipselsp callback should return the correct default value):
56   let cmd = [ ale#Escape('java'),
57     \ '',
58     \ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
59     \ '-Dosgi.bundles.defaultStartLevel=4',
60     \ '-Declipse.product=org.eclipse.jdt.ls.core.product',
61     \ '-Dlog.level=ALL',
62     \ '-noverify',
63     \ '-Xmx1G',
64     \ '-jar',
65     \ ale#Escape(''),
66     \ '-configuration',
67     \ ale#Escape(b:cfg),
68     \ '-data',
69     \ ale#Escape(ale#path#Simplify(''))
70     \]
71   AssertLinter 'java', join(cmd, ' ')
72
73 Execute(The eclipselsp callback should allow custom executable):
74   let b:ale_java_eclipselsp_executable='/bin/foobar'
75   let cmd = [ ale#Escape('/bin/foobar'),
76     \ '',
77     \ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
78     \ '-Dosgi.bundles.defaultStartLevel=4',
79     \ '-Declipse.product=org.eclipse.jdt.ls.core.product',
80     \ '-Dlog.level=ALL',
81     \ '-noverify',
82     \ '-Xmx1G',
83     \ '-jar',
84     \ ale#Escape(''),
85     \ '-configuration',
86     \ ale#Escape(b:cfg),
87     \ '-data',
88     \ ale#Escape(ale#path#Simplify(''))
89     \]
90   AssertLinter '/bin/foobar', join(cmd, ' ')
91
92 Execute(The eclipselsp callback should allow custom configuration path and javaagent):
93   let b:ale_java_eclipselsp_config_path = '/home/config'
94   let b:ale_java_eclipselsp_javaagent = '/home/lombok.jar /home/lombok2.jar'
95   let cmd = [ ale#Escape('java'),
96     \ ale#Escape('-javaagent:/home/lombok.jar'),
97     \ ale#Escape('-javaagent:/home/lombok2.jar'),
98     \ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
99     \ '-Dosgi.bundles.defaultStartLevel=4',
100     \ '-Declipse.product=org.eclipse.jdt.ls.core.product',
101     \ '-Dlog.level=ALL',
102     \ '-noverify',
103     \ '-Xmx1G',
104     \ '-jar',
105     \ ale#Escape(''),
106     \ '-configuration',
107     \ ale#Escape(ale#path#Simplify('/home/config')),
108     \ '-data',
109     \ ale#Escape(ale#path#Simplify(''))
110     \]
111   AssertLinter 'java', join(cmd, ' ')