2019-06-03 19:30:18 +00:00
|
|
|
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):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('test-files/ant/ant-project/Main.java')
|
2019-06-03 19:30:18 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2021-03-20 22:11:22 +00:00
|
|
|
\ ale#path#Simplify(g:dir . '/test-files/ant/ant-project'),
|
2019-06-03 19:30:18 +00:00
|
|
|
\ ale#ant#FindProjectRoot(bufnr(''))
|
|
|
|
|
|
|
|
Execute(Should return root directory if called on a deeply nested source file):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('test-files/ant/ant-project/src/several/namespace/layers/A.java')
|
2019-06-03 19:30:18 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2021-03-20 22:11:22 +00:00
|
|
|
\ ale#path#Simplify(g:dir . '/test-files/ant/ant-project'),
|
2019-06-03 19:30:18 +00:00
|
|
|
\ ale#ant#FindProjectRoot(bufnr(''))
|
|
|
|
|
|
|
|
Execute(Should return empty string if called on a non-ant project):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('test-files/ant/non-ant-project/Main.java')
|
2019-06-03 19:30:18 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ '',
|
|
|
|
\ ale#ant#FindProjectRoot(bufnr(''))
|
|
|
|
|
|
|
|
Execute(Should return empty string if called on a file in a non-ant project):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('test-files/ant/non-ant-project/several/namespace/layers/A.java')
|
2019-06-03 19:30:18 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ '',
|
|
|
|
\ ale#ant#FindProjectRoot(bufnr(''))
|