2017-03-31 19:14:53 +00:00
|
|
|
Before:
|
|
|
|
runtime ale_linters/java/javac.vim
|
|
|
|
call ale#engine#InitBufferInfo(bufnr(''))
|
|
|
|
|
2017-04-25 21:32:48 +00:00
|
|
|
silent! cd /testplugin/test/command_callback
|
|
|
|
|
2017-03-31 19:14:53 +00:00
|
|
|
After:
|
|
|
|
call ale#linter#Reset()
|
|
|
|
" We need to clean up the buffer to remove the temporary directories created
|
|
|
|
" for the command.
|
2017-07-07 22:47:41 +00:00
|
|
|
call ale#engine#Cleanup(bufnr(''))
|
2017-03-31 19:14:53 +00:00
|
|
|
let g:ale_java_javac_options = ''
|
|
|
|
let g:ale_java_javac_classpath = ''
|
|
|
|
|
|
|
|
Execute(The javac callback should return the correct default value):
|
2017-04-25 21:32:48 +00:00
|
|
|
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [])
|
2017-03-31 19:14:53 +00:00
|
|
|
|
2017-05-08 21:59:25 +00:00
|
|
|
Assert match(b:command, '\v^javac +-Xlint +-d +''/tmp/[0-9a-zA-Z/]+'' +\%t$') >= 0,
|
2017-03-31 19:14:53 +00:00
|
|
|
\ 'Invalid command string: ' . b:command
|
|
|
|
|
|
|
|
Execute(The javac callback should use g:ale_java_javac_classpath correctly):
|
|
|
|
let g:ale_java_javac_classpath = 'foo.jar'
|
|
|
|
|
2017-04-25 21:32:48 +00:00
|
|
|
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [])
|
|
|
|
|
2017-05-08 21:59:25 +00:00
|
|
|
Assert match(b:command, '\v^javac +-Xlint +-cp ''+foo\.jar'' +-d ''+/tmp/[0-9a-zA-Z/]+'' +\%t$') >= 0,
|
2017-04-25 21:32:48 +00:00
|
|
|
\ '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',
|
|
|
|
\])
|
2017-03-31 19:14:53 +00:00
|
|
|
|
2017-05-08 21:59:25 +00:00
|
|
|
Assert match(b:command, '\v^javac +-Xlint +-cp ''+/foo/bar\.jar:/xyz/abc\.jar'' +-d +''/tmp/[0-9a-zA-Z/]+'' +\%t$') >= 0,
|
2017-04-25 21:32:48 +00:00
|
|
|
\ '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',
|
|
|
|
\])
|
|
|
|
|
2017-05-08 21:59:25 +00:00
|
|
|
Assert match(b:command, '\v^javac +-Xlint +-cp +''/foo/bar\.jar:/xyz/abc\.jar:configured\.jar'' +-d ''+/tmp/[0-9a-zA-Z/]+'' +\%t$') >= 0,
|
2017-04-25 21:32:48 +00:00
|
|
|
\ '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',
|
|
|
|
\])
|
|
|
|
|
2017-05-08 21:59:25 +00:00
|
|
|
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,
|
2017-04-25 21:32:48 +00:00
|
|
|
\ 'Invalid command string: ' . b:command
|
|
|
|
|
|
|
|
Execute(The javac callback should detect source directories):
|
2017-07-07 22:47:41 +00:00
|
|
|
call ale#engine#Cleanup(bufnr(''))
|
2017-04-25 21:32:48 +00:00
|
|
|
:e! java_paths/src/main/java/com/something/dummy
|
|
|
|
call ale#engine#InitBufferInfo(bufnr(''))
|
|
|
|
|
|
|
|
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [])
|
|
|
|
|
2017-05-08 21:59:25 +00:00
|
|
|
Assert match(b:command, '\v^javac +-Xlint +-sourcepath ''/.*java_paths/src/main/java/'' +-d +''/tmp/[0-9a-zA-Z/]+'' +\%t$') >= 0,
|
2017-04-25 21:32:48 +00:00
|
|
|
\ 'Invalid command string: ' . b:command
|
|
|
|
|
|
|
|
Execute(The javac callback should combine detected source directories and classpaths):
|
2017-07-07 22:47:41 +00:00
|
|
|
call ale#engine#Cleanup(bufnr(''))
|
2017-04-25 21:32:48 +00:00
|
|
|
: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',
|
|
|
|
\])
|
|
|
|
|
2017-05-08 21:59:25 +00:00
|
|
|
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,
|
2017-03-31 19:14:53 +00:00
|
|
|
\ 'Invalid command string: ' . b:command
|
|
|
|
|
|
|
|
Execute(The javac callback should use g:ale_java_javac_options correctly):
|
2017-04-25 21:32:48 +00:00
|
|
|
|
2017-03-31 19:14:53 +00:00
|
|
|
let g:ale_java_javac_options = '--anything --else'
|
|
|
|
|
2017-04-25 21:32:48 +00:00
|
|
|
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [])
|
2017-03-31 19:14:53 +00:00
|
|
|
|
2017-05-08 21:59:25 +00:00
|
|
|
Assert match(b:command, '\v^javac +-Xlint +-d +''/tmp/[0-9a-zA-Z/]+'' --anything --else +\%t$') >= 0,
|
2017-03-31 19:14:53 +00:00
|
|
|
\ 'Invalid command string: ' . b:command
|