2018-12-01 05:53:49 +00:00
|
|
|
Before:
|
|
|
|
call ale#assert#SetUpLinterTest('java', 'eclipselsp')
|
|
|
|
call ale#test#SetFilename('dummy.java')
|
|
|
|
|
2019-05-21 20:23:21 +00:00
|
|
|
let b:ale_java_eclipselsp_path = '/home/user/eclipse.dst.ls'
|
|
|
|
|
|
|
|
let b:cfg = ale#path#Simplify(g:dir . '/../config_linux')
|
2018-12-01 05:53:49 +00:00
|
|
|
|
|
|
|
if has('win32')
|
2019-05-21 20:23:21 +00:00
|
|
|
let b:cfg = ale#path#Simplify(g:dir . '/../config_win')
|
2018-12-01 05:53:49 +00:00
|
|
|
elseif has('macunix')
|
2019-05-21 20:23:21 +00:00
|
|
|
let b:cfg = ale#path#Simplify(g:dir . '/../config_mac')
|
2018-12-01 05:53:49 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
After:
|
2019-05-21 20:23:21 +00:00
|
|
|
unlet! b:ale_java_eclipselsp_path
|
|
|
|
unlet! b:cfg
|
|
|
|
|
2018-12-01 05:53:49 +00:00
|
|
|
call ale#assert#TearDownLinterTest()
|
|
|
|
|
|
|
|
Execute(VersionCheck should return correct version):
|
|
|
|
|
|
|
|
" OpenJDK Java 1.8
|
|
|
|
AssertEqual [1, 8, 0], ale_linters#java#eclipselsp#VersionCheck([
|
|
|
|
\ 'openjdk version "1.8.0_191"',
|
|
|
|
\ 'OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-0ubuntu0.18.04.1-b12)',
|
|
|
|
\ 'OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)'
|
|
|
|
\])
|
|
|
|
|
|
|
|
" OpenJDK Java 10
|
|
|
|
AssertEqual [10, 0, 2], ale_linters#java#eclipselsp#VersionCheck([
|
|
|
|
\ 'openjdk version "10.0.2" 2018-07-17',
|
|
|
|
\ 'OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)',
|
|
|
|
\ 'OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)'
|
|
|
|
\])
|
|
|
|
|
|
|
|
" Oracle Java 1.8
|
|
|
|
AssertEqual [1, 8, 0], ale_linters#java#eclipselsp#VersionCheck([
|
|
|
|
\ 'java version "1.8.0_161"',
|
|
|
|
\ 'Java(TM) SE Runtime Environment (build 1.8.0_161-b12)',
|
|
|
|
\ 'Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)'
|
|
|
|
\])
|
|
|
|
|
|
|
|
" Oracle Java 10
|
|
|
|
AssertEqual [10, 0, 1], ale_linters#java#eclipselsp#VersionCheck([
|
|
|
|
\ 'java version "10.0.1" 2018-04-17',
|
|
|
|
\ 'Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)',
|
|
|
|
\ 'Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)'
|
|
|
|
\])
|
|
|
|
|
|
|
|
AssertEqual [], ale_linters#java#eclipselsp#VersionCheck(['x'])
|
|
|
|
|
|
|
|
AssertEqual [], ale_linters#java#eclipselsp#VersionCheck([])
|
|
|
|
|
|
|
|
Execute(The eclipselsp callback should return the correct default value):
|
|
|
|
let cmd = [ ale#Escape('java'),
|
2020-03-26 06:40:07 +00:00
|
|
|
\ '',
|
2018-12-01 05:53:49 +00:00
|
|
|
\ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
|
|
|
\ '-Dosgi.bundles.defaultStartLevel=4',
|
|
|
|
\ '-Declipse.product=org.eclipse.jdt.ls.core.product',
|
|
|
|
\ '-Dlog.level=ALL',
|
|
|
|
\ '-noverify',
|
|
|
|
\ '-Xmx1G',
|
|
|
|
\ '-jar',
|
2019-05-21 04:33:47 +00:00
|
|
|
\ ale#Escape(''),
|
2018-12-01 05:53:49 +00:00
|
|
|
\ '-configuration',
|
2019-05-21 04:33:47 +00:00
|
|
|
\ ale#Escape(b:cfg),
|
2018-12-01 05:53:49 +00:00
|
|
|
\ '-data',
|
2019-05-21 04:33:47 +00:00
|
|
|
\ ale#Escape(ale#path#Simplify(''))
|
2018-12-01 05:53:49 +00:00
|
|
|
\]
|
|
|
|
AssertLinter 'java', join(cmd, ' ')
|
|
|
|
|
|
|
|
Execute(The eclipselsp callback should allow custom executable):
|
|
|
|
let b:ale_java_eclipselsp_executable='/bin/foobar'
|
|
|
|
let cmd = [ ale#Escape('/bin/foobar'),
|
2020-03-26 06:40:07 +00:00
|
|
|
\ '',
|
2018-12-01 05:53:49 +00:00
|
|
|
\ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
|
|
|
\ '-Dosgi.bundles.defaultStartLevel=4',
|
|
|
|
\ '-Declipse.product=org.eclipse.jdt.ls.core.product',
|
|
|
|
\ '-Dlog.level=ALL',
|
|
|
|
\ '-noverify',
|
|
|
|
\ '-Xmx1G',
|
|
|
|
\ '-jar',
|
2019-05-21 04:33:47 +00:00
|
|
|
\ ale#Escape(''),
|
2018-12-01 05:53:49 +00:00
|
|
|
\ '-configuration',
|
2019-05-21 04:33:47 +00:00
|
|
|
\ ale#Escape(b:cfg),
|
2018-12-01 05:53:49 +00:00
|
|
|
\ '-data',
|
2019-05-21 04:33:47 +00:00
|
|
|
\ ale#Escape(ale#path#Simplify(''))
|
2018-12-01 05:53:49 +00:00
|
|
|
\]
|
|
|
|
AssertLinter '/bin/foobar', join(cmd, ' ')
|
|
|
|
|
2020-03-26 06:40:07 +00:00
|
|
|
Execute(The eclipselsp callback should allow custom configuration path and javaagent):
|
2019-05-21 20:23:21 +00:00
|
|
|
let b:ale_java_eclipselsp_config_path = '/home/config'
|
2020-03-26 06:40:07 +00:00
|
|
|
let b:ale_java_eclipselsp_javaagent = '/home/lombok.jar /home/lombok2.jar'
|
2019-05-21 20:13:06 +00:00
|
|
|
let cmd = [ ale#Escape('java'),
|
2020-03-26 06:40:07 +00:00
|
|
|
\ ale#Escape('-javaagent:/home/lombok.jar'),
|
|
|
|
\ ale#Escape('-javaagent:/home/lombok2.jar'),
|
2019-05-21 20:13:06 +00:00
|
|
|
\ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
|
|
|
\ '-Dosgi.bundles.defaultStartLevel=4',
|
|
|
|
\ '-Declipse.product=org.eclipse.jdt.ls.core.product',
|
|
|
|
\ '-Dlog.level=ALL',
|
|
|
|
\ '-noverify',
|
|
|
|
\ '-Xmx1G',
|
|
|
|
\ '-jar',
|
2019-05-21 04:33:47 +00:00
|
|
|
\ ale#Escape(''),
|
2019-05-21 20:13:06 +00:00
|
|
|
\ '-configuration',
|
2019-05-21 04:33:47 +00:00
|
|
|
\ ale#Escape(ale#path#Simplify('/home/config')),
|
2019-05-21 20:13:06 +00:00
|
|
|
\ '-data',
|
2019-05-21 04:33:47 +00:00
|
|
|
\ ale#Escape(ale#path#Simplify(''))
|
2019-05-21 20:13:06 +00:00
|
|
|
\]
|
|
|
|
AssertLinter 'java', join(cmd, ' ')
|