Modify the shmft tests so they won't mess with your settings

This commit is contained in:
w0rp 2017-11-05 21:31:41 +00:00
parent 716b22d524
commit 3c8e6ed51c

View File

@ -2,23 +2,23 @@ Before:
Save g:ale_sh_shfmt_executable Save g:ale_sh_shfmt_executable
Save g:ale_sh_shfmt_options Save g:ale_sh_shfmt_options
" Use an invalid global executable, so we don't match it. After:
let g:ale_sh_shfmt_executable = 'xxxinvalid' Restore
let g:ale_sh_shfmt_options = ''
Execute(The shfmt callback should return the correct default values): Execute(The shfmt callback should return the correct default values):
AssertEqual AssertEqual
\ { \ {
\ 'command': ale#Escape('xxxinvalid'), \ 'command': ale#Escape('shfmt'),
\ }, \ },
\ ale#fixers#shfmt#Fix(bufnr('')) \ ale#fixers#shfmt#Fix(bufnr(''))
Execute(The shfmt callback should include custom shfmt options): Execute(The shfmt executable and options should be configurable):
let g:ale_sh_shfmt_executable = 'foobar'
let g:ale_sh_shfmt_options = '--some-option' let g:ale_sh_shfmt_options = '--some-option'
AssertEqual AssertEqual
\ { \ {
\ 'command': ale#Escape(g:ale_sh_shfmt_executable) \ 'command': ale#Escape('foobar')
\ . ' --some-option', \ . ' --some-option',
\ }, \ },
\ ale#fixers#shfmt#Fix(bufnr('')) \ ale#fixers#shfmt#Fix(bufnr(''))