diff options
author | w0rp <devw0rp@gmail.com> | 2017-04-25 22:32:48 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-04-25 22:32:48 +0100 |
commit | 45c2d6b580e8e4bfe73412667268c48a3034caf5 (patch) | |
tree | 9d855eb71f5b9a92ca7b2d2007e011bb2b2cb3de /test/command_callback/test_javac_command_callback.vader | |
parent | fe51866dfc1dd8e6ed30cc5946c3a8093282cb9c (diff) | |
download | ale-45c2d6b580e8e4bfe73412667268c48a3034caf5.zip |
Fixes #361, fixes #417 Get classpaths from Maven, and automatically detect src/main/java paths
Diffstat (limited to 'test/command_callback/test_javac_command_callback.vader')
-rw-r--r-- | test/command_callback/test_javac_command_callback.vader | 72 |
1 files changed, 68 insertions, 4 deletions
diff --git a/test/command_callback/test_javac_command_callback.vader b/test/command_callback/test_javac_command_callback.vader index 52aeff44..534e63de 100644 --- a/test/command_callback/test_javac_command_callback.vader +++ b/test/command_callback/test_javac_command_callback.vader @@ -2,6 +2,8 @@ Before: runtime ale_linters/java/javac.vim call ale#engine#InitBufferInfo(bufnr('')) + silent! cd /testplugin/test/command_callback + After: call ale#linter#Reset() " We need to clean up the buffer to remove the temporary directories created @@ -11,7 +13,7 @@ After: let g:ale_java_javac_classpath = '' Execute(The javac callback should return the correct default value): - let b:command = ale_linters#java#javac#GetCommand(bufnr('')) + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), []) Assert match(b:command, '\v^javac +-Xlint +-d +/tmp/[0-9a-zA-Z/]+ +\%t$') >= 0, \ 'Invalid command string: ' . b:command @@ -19,15 +21,77 @@ Execute(The javac callback should return the correct default value): Execute(The javac callback should use g:ale_java_javac_classpath correctly): let g:ale_java_javac_classpath = 'foo.jar' - let b:command = ale_linters#java#javac#GetCommand(bufnr('')) + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), []) + + Assert match(b:command, '\v^javac +-Xlint +-cp +foo\.jar +-d +/tmp/[0-9a-zA-Z/]+ +\%t$') >= 0, + \ 'Invalid command string: ' . b:command + +Execute(The javac callback should include discovered classpaths): + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [ + \ '[DEBUG] Ignore this.', + \ '[INFO] Something we should ignore.', + \ '/foo/bar.jar', + \ '/xyz/abc.jar', + \]) - Assert match(b:command, '\v^javac +-Xlint -cp foo\.jar +-d +/tmp/[0-9a-zA-Z/]+ +\%t$') >= 0, + Assert match(b:command, '\v^javac +-Xlint +-cp +/foo/bar\.jar:/xyz/abc\.jar +-d +/tmp/[0-9a-zA-Z/]+ +\%t$') >= 0, + \ 'Invalid command string: ' . b:command + +Execute(The javac callback should combine discovered classpaths and manual ones): + let g:ale_java_javac_classpath = 'configured.jar' + + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [ + \ '[DEBUG] Ignore this.', + \ '[INFO] Something we should ignore.', + \ '/foo/bar.jar', + \ '/xyz/abc.jar', + \]) + + Assert match(b:command, '\v^javac +-Xlint +-cp +/foo/bar\.jar:/xyz/abc\.jar:configured\.jar +-d +/tmp/[0-9a-zA-Z/]+ +\%t$') >= 0, + \ 'Invalid command string: ' . b:command + + let g:ale_java_javac_classpath = 'configured.jar:configured2.jar' + + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [ + \ '[DEBUG] Ignore this.', + \ '[INFO] Something we should ignore.', + \ '/foo/bar.jar', + \ '/xyz/abc.jar', + \]) + + Assert match(b:command, '\v^javac +-Xlint +-cp +/foo/bar\.jar:/xyz/abc\.jar:configured\.jar:configured2\.jar +-d +/tmp/[0-9a-zA-Z/]+ +\%t$') >= 0, + \ 'Invalid command string: ' . b:command + +Execute(The javac callback should detect source directories): + call ale#cleanup#Buffer(bufnr('')) + :e! java_paths/src/main/java/com/something/dummy + call ale#engine#InitBufferInfo(bufnr('')) + + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), []) + + Assert match(b:command, '\v^javac +-Xlint +-sourcepath /.*java_paths/src/main/java/ +-d +/tmp/[0-9a-zA-Z/]+ +\%t$') >= 0, + \ 'Invalid command string: ' . b:command + +Execute(The javac callback should combine detected source directories and classpaths): + call ale#cleanup#Buffer(bufnr('')) + :e! java_paths/src/main/java/com/something/dummy + call ale#engine#InitBufferInfo(bufnr('')) + + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [ + \ '[DEBUG] Ignore this.', + \ '[INFO] Something we should ignore.', + \ '/foo/bar.jar', + \ '/xyz/abc.jar', + \]) + + Assert match(b:command, '\v^javac +-Xlint +-cp +/foo/bar\.jar:/xyz/abc\.jar +-sourcepath /.*java_paths/src/main/java/ +-d +/tmp/[0-9a-zA-Z/]+ +\%t$') >= 0, \ 'Invalid command string: ' . b:command Execute(The javac callback should use g:ale_java_javac_options correctly): + let g:ale_java_javac_options = '--anything --else' - let b:command = ale_linters#java#javac#GetCommand(bufnr('')) + let b:command = ale_linters#java#javac#GetCommand(bufnr(''), []) Assert match(b:command, '\v^javac +-Xlint +-d +/tmp/[0-9a-zA-Z/]+ --anything --else +\%t$') >= 0, \ 'Invalid command string: ' . b:command |