ale/test/test_maven_build_classpath_...

54 lines
1.6 KiB
Plaintext
Raw Normal View History

2019-12-16 00:18:13 +00:00
Before:
Save $PATH
Save $PATHEXT
let $PATHEXT = '.'
call ale#test#SetDirectory('/testplugin/test')
runtime ale_linters/java/javac.vim
let g:expected_wrapper = ''
if has('unix')
let g:expected_wrapper = 'mvnw'
else
let g:expected_wrapper = 'mvnw.cmd'
endif
After:
Restore
unlet! g:expected_wrapper
call ale#test#RestoreDirectory()
call ale#linter#Reset()
Execute(Should use 'mvnw' in classpath command if available):
call ale#test#SetFilename('test-files/maven/maven-java-project/module1/src/main/java/dummy1.java')
2019-12-16 00:18:13 +00:00
AssertEqual
\ [
\ ale#path#Simplify(g:dir . '/test-files/maven/maven-java-project/module1'),
\ ale#Escape(ale#path#Simplify(g:dir . '/test-files/maven/maven-java-project/module1/' . g:expected_wrapper))
\ . ' dependency:build-classpath',
\ ],
2019-12-16 00:18:13 +00:00
\ ale#maven#BuildClasspathCommand(bufnr(''))
Execute(Should use 'mvn' in classpath command if it is executable and 'mvnw' is unavailable):
call ale#test#SetFilename('test-files/maven/maven-java-project/module2/src/main/java/dummy2.java')
2019-12-16 00:18:13 +00:00
let $PATH .= (has('win32') ? ';' : ':')
\ . ale#path#Simplify(g:dir . '/test-files/maven')
2019-12-16 00:18:13 +00:00
AssertEqual
\ [
\ ale#path#Simplify(g:dir . '/test-files/maven/maven-java-project/module2'),
\ ale#Escape('mvn')
\ . ' dependency:build-classpath',
\ ],
2019-12-16 00:18:13 +00:00
\ ale#maven#BuildClasspathCommand(bufnr(''))
Execute(Should return empty string if maven cannot be executed):
call ale#test#SetFilename('test-files/maven/non-maven-project/src/main/java/dummy.java')
2019-12-16 00:18:13 +00:00
AssertEqual
\ ['', ''],
2019-12-16 00:18:13 +00:00
\ ale#maven#BuildClasspathCommand(bufnr(''))