This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
ale/test/test_gradle_build_classpath_command.vader
w0rp 9fe7b1fe6a
Close #2281 - Separate cwd commands from commands
Working directories are now set seperately from the commands so they
can later be swapped out when running linters over projects is
supported, and also better support filename mapping for running linters
on other machines in future.
2021-03-01 20:11:10 +00:00

52 lines
1.6 KiB
Text

Before:
Save $PATH
Save $PATHEXT
let $PATHEXT = '.'
call ale#test#SetDirectory('/testplugin/test')
runtime ale_linters/kotlin/kotlinc.vim
let g:command_tail = ' -I ' . ale#Escape(ale#gradle#GetInitPath())
\ . ' -q printClasspath'
let g:gradle_init_path = ale#path#Simplify(g:dir . '../../autoload/ale/gradle/init.gradle')
After:
Restore
unlet! g:gradle_init_path
unlet! g:command_tail
call ale#test#RestoreDirectory()
call ale#linter#Reset()
Execute(Should return 'gradlew' command if project includes gradle wapper):
call ale#test#SetFilename('gradle-test-files/wrapped-project/src/main/kotlin/dummy.kt')
AssertEqual
\ [
\ ale#path#Simplify(g:dir . '/gradle-test-files/wrapped-project'),
\ ale#Escape(ale#path#Simplify(g:dir . '/gradle-test-files/wrapped-project/gradlew'))
\ . g:command_tail,
\ ],
\ ale#gradle#BuildClasspathCommand(bufnr(''))
Execute(Should return 'gradle' command if project does not include gradle wapper):
call ale#test#SetFilename('gradle-test-files/unwrapped-project/src/main/kotlin/dummy.kt')
let $PATH .= (has('win32') ? ';' : ':')
\ . ale#path#Simplify(g:dir . '/gradle-test-files')
AssertEqual
\ [
\ ale#path#Simplify(g:dir . '/gradle-test-files/unwrapped-project'),
\ ale#Escape('gradle') . g:command_tail
\ ],
\ ale#gradle#BuildClasspathCommand(bufnr(''))
Execute(Should return empty string if gradle cannot be executed):
call ale#test#SetFilename('gradle-test-files/non-gradle-project/src/main/kotlin/dummy.kt')
AssertEqual
\ ['', ''],
\ ale#gradle#BuildClasspathCommand(bufnr(''))