mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-08 13:34:46 +08:00
Fix #1031 - Make the rust flags configurable
This commit is contained in:
37
test/command_callback/test_rustc_command_callback.vader
Normal file
37
test/command_callback/test_rustc_command_callback.vader
Normal file
@@ -0,0 +1,37 @@
|
||||
Before:
|
||||
Save g:ale_rust_rustc_options
|
||||
|
||||
unlet! g:ale_rust_rustc_options
|
||||
|
||||
runtime ale_linters/rust/rustc.vim
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_rust_rustc_options
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertEqual
|
||||
\ 'rustc --error-format=json -Z no-trans -',
|
||||
\ ale_linters#rust#rustc#RustcCommand(bufnr(''))
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_rust_rustc_options = '--foo'
|
||||
|
||||
AssertEqual
|
||||
\ 'rustc --error-format=json --foo -',
|
||||
\ ale_linters#rust#rustc#RustcCommand(bufnr(''))
|
||||
|
||||
Execute(Some default paths should be included when the project is a Cargo project):
|
||||
call ale#test#SetFilename('cargo_paths/test.rs')
|
||||
|
||||
AssertEqual
|
||||
\ 'rustc --error-format=json -Z no-trans'
|
||||
\ . ' -L ' . ale#Escape(ale#path#GetAbsPath(g:dir, 'cargo_paths/target/debug/deps'))
|
||||
\ . ' -L ' . ale#Escape(ale#path#GetAbsPath(g:dir, 'cargo_paths/target/release/deps'))
|
||||
\ . ' -',
|
||||
\ ale_linters#rust#rustc#RustcCommand(bufnr(''))
|
||||
Reference in New Issue
Block a user