mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-02 09:33:31 +08:00
Add shfmt fixer for sh files (#1083)
* Add shfmt fixer for sh files * Add tests for shfmt fixer
This commit is contained in:
24
test/fixers/test_shfmt_fixer_callback.vader
Normal file
24
test/fixers/test_shfmt_fixer_callback.vader
Normal file
@@ -0,0 +1,24 @@
|
||||
Before:
|
||||
Save g:ale_sh_shfmt_executable
|
||||
Save g:ale_sh_shfmt_options
|
||||
|
||||
" Use an invalid global executable, so we don't match it.
|
||||
let g:ale_sh_shfmt_executable = 'xxxinvalid'
|
||||
let g:ale_sh_shfmt_options = ''
|
||||
|
||||
Execute(The shfmt callback should return the correct default values):
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('xxxinvalid'),
|
||||
\ },
|
||||
\ ale#fixers#shfmt#Fix(bufnr(''))
|
||||
|
||||
Execute(The shfmt callback should include custom shfmt options):
|
||||
let g:ale_sh_shfmt_options = '--some-option'
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(g:ale_sh_shfmt_executable)
|
||||
\ . ' --some-option',
|
||||
\ },
|
||||
\ ale#fixers#shfmt#Fix(bufnr(''))
|
||||
Reference in New Issue
Block a user