blob: 1d2f6da279262e491ce7070ad0d3be43236f4b24 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
Before:
Save $PATH
Save $PATHEXT
" Count the maven executable without .exe as executable on Windows
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 return 'mvnw' if found in parent directory):
call ale#test#SetFilename('maven-test-files/maven-java-project/module1/src/main/java/dummy1.java')
AssertEqual
\ ale#path#Simplify(g:dir . '/maven-test-files/maven-java-project/module1/' . g:expected_wrapper),
\ ale#maven#FindExecutable(bufnr(''))
Execute(Should return 'mvn' if 'mvnw' not found in parent directory):
call ale#test#SetFilename('maven-test-files/maven-java-project/module2/src/main/java/dummy2.java')
let $PATH .= (has('win32') ? ';' : ':')
\ . ale#path#Simplify(g:dir . '/maven-test-files')
AssertEqual
\ 'mvn',
\ ale#maven#FindExecutable(bufnr(''))
Execute(Should return empty string if 'mvnw' not in parent directory and mvn not in path):
call ale#test#SetFilename('mvn-test-files/java-maven-project/module2/src/main/java/dummy2.java')
AssertEqual
\ '',
\ ale#gradle#FindExecutable(bufnr(''))
|