mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-10 05:22:31 +08:00
Feature/add ant support (#2539)
Use ant files to load Java settings too.
This commit is contained in:
0
test/ant-test-files/ant-project/build.xml
Normal file
0
test/ant-test-files/ant-project/build.xml
Normal file
0
test/ant-test-files/bin/ant
Executable file
0
test/ant-test-files/bin/ant
Executable file
0
test/ant-test-files/bin/ant.exe
Executable file
0
test/ant-test-files/bin/ant.exe
Executable file
29
test/test_ant_build_classpath_command.vader
Normal file
29
test/test_ant_build_classpath_command.vader
Normal file
@@ -0,0 +1,29 @@
|
||||
Before:
|
||||
call ale#test#SetDirectory('/testplugin/test')
|
||||
runtime ale_linters/java/javac.vim
|
||||
|
||||
Save $PATH
|
||||
let $PATH = ale#path#Simplify(g:dir . '/ant-test-files/bin')
|
||||
|
||||
let g:valid_project = 'ant-test-files/ant-project'
|
||||
let g:invalid_project = 'ant-test-files/non-ant-project'
|
||||
let g:command_tail = ' classpath' . ' -S' . ' -q'
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! g:command_tail
|
||||
unlet! g:valid_project
|
||||
unlet! g:invalid_project
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(Should return `cd '[dir]' && 'ant' classpath -S -q`):
|
||||
call ale#test#SetFilename(valid_project . '/Main.java')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#CdString(ale#path#Simplify(g:dir . '/ant-test-files/ant-project'))
|
||||
\ . ale#Escape('ant')
|
||||
\ . g:command_tail,
|
||||
\ ale#ant#BuildClasspathCommand(bufnr(''))
|
||||
35
test/test_ant_find_project_root.vader
Normal file
35
test/test_ant_find_project_root.vader
Normal file
@@ -0,0 +1,35 @@
|
||||
Before:
|
||||
call ale#test#SetDirectory('/testplugin/test')
|
||||
runtime ale_linters/java/javac.vim
|
||||
|
||||
After:
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(Should return current directory if called on the project root):
|
||||
call ale#test#SetFilename('ant-test-files/ant-project/Main.java')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/ant-test-files/ant-project'),
|
||||
\ ale#ant#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(Should return root directory if called on a deeply nested source file):
|
||||
call ale#test#SetFilename('ant-test-files/ant-project/src/several/namespace/layers/A.java')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/ant-test-files/ant-project'),
|
||||
\ ale#ant#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(Should return empty string if called on a non-ant project):
|
||||
call ale#test#SetFilename('ant-test-files/non-ant-project/Main.java')
|
||||
|
||||
AssertEqual
|
||||
\ '',
|
||||
\ ale#ant#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(Should return empty string if called on a file in a non-ant project):
|
||||
call ale#test#SetFilename('ant-test-files/non-ant-project/several/namespace/layers/A.java')
|
||||
|
||||
AssertEqual
|
||||
\ '',
|
||||
\ ale#ant#FindProjectRoot(bufnr(''))
|
||||
Reference in New Issue
Block a user