ale/test/command_callback/test_rust_rls_callbacks.vader
eyenseo 6c93cded64 Fix rust rls linter toolchain argument
This removes the argument if the specified toolchain is empty.
As far as I can tell there is no +nighly (or similar) option [1] leading to
the termination of the server. But since people needed this option and
have yet to complain about it it stays the default for now.

[1] https://github.com/rust-lang-nursery/rls/blob/master/src/main.rs#L87
2018-04-12 20:42:38 +02:00

49 lines
1.3 KiB
Plaintext

Before:
Save g:ale_rust_rls_executable
Save g:ale_rust_rls_toolchain
unlet! g:ale_rust_rls_executable
unlet! g:ale_rust_rls_toolchain
runtime ale_linters/rust/rls.vim
call ale#test#SetDirectory('/testplugin/test/command_callback')
After:
Restore
call ale#test#RestoreDirectory()
call ale#linter#Reset()
Execute(The default executable path should be correct):
AssertEqual 'rls', ale_linters#rust#rls#GetExecutable(bufnr(''))
AssertEqual
\ ale#Escape('rls') . ' +' . ale#Escape('nightly'),
\ ale_linters#rust#rls#GetCommand(bufnr(''))
Execute(The toolchain should be configurable):
let g:ale_rust_rls_toolchain = 'stable'
AssertEqual
\ ale#Escape('rls') . ' +' . ale#Escape('stable'),
\ ale_linters#rust#rls#GetCommand(bufnr(''))
Execute(The toolchain should be ommitted if not given):
let g:ale_rust_rls_toolchain = ''
AssertEqual
\ ale#Escape('rls'),
\ ale_linters#rust#rls#GetCommand(bufnr(''))
Execute(The language string should be correct):
AssertEqual 'rust', ale_linters#rust#rls#GetLanguage(bufnr(''))
Execute(The project root should be detected correctly):
AssertEqual '', ale_linters#rust#rls#GetProjectRoot(bufnr(''))
call ale#test#SetFilename('rust-rls-project/test.rs')
AssertEqual
\ ale#path#Simplify(g:dir . '/rust-rls-project'),
\ ale_linters#rust#rls#GetProjectRoot(bufnr(''))