summaryrefslogtreecommitdiff
path: root/test/command_callback/test_javac_command_callback.vader
diff options
context:
space:
mode:
authorNiBo <nibocn@gmail.com>2020-05-18 17:35:16 +0800
committerNiBo <nibocn@gmail.com>2020-05-19 10:41:35 +0800
commitff6bfc3d374706ab80d3dc40a4d3a15baffa8ad2 (patch)
tree2f1c496bb4ddbc256a4d1bed33290e630ba99e37 /test/command_callback/test_javac_command_callback.vader
parent3635285c022ebaa0fe3d54ca74cac1207dda555b (diff)
downloadale-ff6bfc3d374706ab80d3dc40a4d3a15baffa8ad2.zip
refactor(javac): ale_java_javac_sourcepath variable supports String and List types
Diffstat (limited to 'test/command_callback/test_javac_command_callback.vader')
-rw-r--r--test/command_callback/test_javac_command_callback.vader86
1 files changed, 86 insertions, 0 deletions
diff --git a/test/command_callback/test_javac_command_callback.vader b/test/command_callback/test_javac_command_callback.vader
index 42c64e54..7e612ae2 100644
--- a/test/command_callback/test_javac_command_callback.vader
+++ b/test/command_callback/test_javac_command_callback.vader
@@ -108,6 +108,92 @@ Execute(The javac callback should combine discovered classpaths and manual ones)
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
\ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
+Execute(The javac callback should use string type g:ale_java_javac_sourcepath correctly):
+ let g:ale_java_javac_sourcepath = 'java_paths/build/gen/main'
+
+ AssertLinter 'javac',
+ \ g:prefix
+ \ . ' -sourcepath ' . ale#Escape(
+ \ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/')
+ \ )
+ \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
+
+Execute(The javac callback should use list type g:ale_java_javac_sourcepath correctly):
+ let g:ale_java_javac_sourcepath = ['java_paths/build/gen/main']
+
+ AssertLinter 'javac',
+ \ g:prefix
+ \ . ' -sourcepath ' . ale#Escape(
+ \ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/')
+ \ )
+ \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
+
+Execute(The javac callback shouldn't add -sourcepath when g:ale_java_javac_sourcepath variable path doesn't exist):
+ let g:ale_java_javac_sourcepath = 'java_paths/build/gen3/main'
+
+ AssertLinter 'javac',
+ \ g:prefix
+ \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
+
+Execute(The javac callback should combine discovered sourcepath and manual ones):
+ call ale#engine#Cleanup(bufnr(''))
+ call ale#test#SetFilename('java_paths/src/main/java/com/something/dummy.java')
+ call ale#engine#InitBufferInfo(bufnr(''))
+
+ let g:ale_java_javac_sourcepath = 'java_paths/build/gen/main'
+ let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {})
+
+ AssertEqual
+ \ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
+ \ . ' -sourcepath ' . ale#Escape(join([
+ \ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
+ \ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/'),
+ \ ], g:cp_sep))
+ \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
+ \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
+
+ let g:ale_java_javac_sourcepath = 'java_paths/build/gen/main'
+ \ . g:cp_sep . 'java_paths/build/gen2/main'
+ let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {})
+
+ AssertEqual
+ \ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
+ \ . ' -sourcepath ' . ale#Escape(join([
+ \ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
+ \ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/'),
+ \ ale#path#Simplify(g:dir . '/java_paths/build/gen2/main/')
+ \ ], g:cp_sep))
+ \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
+ \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
+
+ let g:ale_java_javac_sourcepath = ['java_paths/build/gen/main']
+ let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {})
+
+ AssertEqual
+ \ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
+ \ . ' -sourcepath ' . ale#Escape(join([
+ \ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
+ \ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/')
+ \ ], g:cp_sep))
+ \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
+ \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
+
+ let g:ale_java_javac_sourcepath = [
+ \ 'java_paths/build/gen/main',
+ \ 'java_paths/build/gen2/main'
+ \ ]
+ let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {})
+
+ AssertEqual
+ \ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
+ \ . ' -sourcepath ' . ale#Escape(join([
+ \ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
+ \ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/'),
+ \ ale#path#Simplify(g:dir . '/java_paths/build/gen2/main/')
+ \ ], g:cp_sep))
+ \ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t',
+ \ substitute(b:command, '%e', '\=ale#Escape(''javac'')', 'g')
+
Execute(The javac callback should detect source directories):
call ale#engine#Cleanup(bufnr(''))
noautocmd e! java_paths/src/main/java/com/something/dummy