summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2019-04-13 12:48:20 +0100
committerGitHub <noreply@github.com>2019-04-13 12:48:20 +0100
commitf0f0cc3c186c46f437d62e6b3e01a45d2a3aaf47 (patch)
treed164e8023e6e94229fb0c8ba4f4c63d2b0ecbaec /test
parent784d1a9a622a0c30c26a17a835943593d036a4cd (diff)
parentf02e2ec54cb39e6fcc73bbaf553cbfb0111944d4 (diff)
downloadale-f0f0cc3c186c46f437d62e6b3e01a45d2a3aaf47.zip
Merge pull request #2121 from hsanson/1996-add-support-for-eclipse-jdt-ls
WIP Fix 1996 - Add eclipse LSP support.
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_eclipselsp_command_callback.vader87
1 files changed, 87 insertions, 0 deletions
diff --git a/test/command_callback/test_eclipselsp_command_callback.vader b/test/command_callback/test_eclipselsp_command_callback.vader
new file mode 100644
index 00000000..f6f587da
--- /dev/null
+++ b/test/command_callback/test_eclipselsp_command_callback.vader
@@ -0,0 +1,87 @@
+Before:
+ call ale#assert#SetUpLinterTest('java', 'eclipselsp')
+ let b:ale_java_eclipselsp_path = '/home/user/eclipse.dst.ls'
+ call ale#test#SetFilename('dummy.java')
+
+ let b:cfg = '/home/user/eclipse.dst.ls/org.eclipse.jdt.ls.product/target/repository/config_linux'
+
+ if has('win32')
+ let b:cfg = '\home\user\eclipse.dst.ls\org.eclipse.jdt.ls.product\target\repository\config_win'
+ elseif has('macunix')
+ let b:cfg = '/home/user/eclipse.dst.ls/org.eclipse.jdt.ls.product/target/repository/config_mac'
+ endif
+
+
+After:
+ unlet b:ale_java_eclipselsp_path
+ 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'),
+ \ '-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',
+ \ '',
+ \ '-configuration',
+ \ b:cfg,
+ \ '-data',
+ \ ''
+ \]
+ 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'),
+ \ '-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',
+ \ '',
+ \ '-configuration',
+ \ b:cfg,
+ \ '-data',
+ \ ''
+ \]
+ AssertLinter '/bin/foobar', join(cmd, ' ')
+