add tests for ale_shell option

This commit is contained in:
Holden 2018-12-28 11:58:55 -05:00
parent 57a04701c3
commit c499825a0b
4 changed files with 11 additions and 4 deletions

View File

@ -1990,7 +1990,7 @@ g:ale_windows_node_executable_path *g:ale_windows_node_executable_path*
scripts are executed with whatever executable is configured with this scripts are executed with whatever executable is configured with this
setting. setting.
g:ale_shell *g:ale_shell* g:ale_shell *g:ale_shell*
Type: |String| Type: |String|
Default: `'&shell'` Default: `'&shell'`
@ -2000,7 +2000,7 @@ g:ale_shell *g:ale_shell*
which corresponds to the $SHELL environment variable. For example which corresponds to the $SHELL environment variable. For example
if `$SHELL == '/bin/bash'`, but you want to use zsh, set `g:ale_shell = '/bin/zsh'.` if `$SHELL == '/bin/bash'`, but you want to use zsh, set `g:ale_shell = '/bin/zsh'.`
g:ale_shell_arguments *g:ale_shell_arguments* g:ale_shell_arguments *g:ale_shell_arguments*
Type: |String| Type: |String|
Default: `'&shellcmdflag'` Default: `'&shellcmdflag'`

View File

@ -26,7 +26,7 @@ Before:
augroup END augroup END
if !has('win32') if !has('win32')
let &shell = '/bin/bash' let g:ale_shell = '/bin/bash'
endif endif
call ale#test#SetDirectory('/testplugin/test') call ale#test#SetDirectory('/testplugin/test')

View File

@ -31,6 +31,6 @@ Execute(Command formatting should be applied correctly for LSP linters):
\ g:args \ g:args
else else
AssertEqual AssertEqual
\ ['true', [&shell, '-c', '''true'' --foo']], \ ['true', [g:ale_shell, '-c', '''true'' --foo']],
\ g:args \ g:args
endif endif

View File

@ -4,6 +4,7 @@ Before:
After: After:
Restore Restore
let g:ale_shell = &shell
Execute(sh should be used when the shell is fish): Execute(sh should be used when the shell is fish):
if !has('win32') if !has('win32')
@ -43,6 +44,7 @@ Execute(Other shells should be used when set):
if !has('win32') if !has('win32')
let &shell = '/bin/bash' let &shell = '/bin/bash'
let &shellcmdflag = '-c' let &shellcmdflag = '-c'
let g:ale_shell = &shell
AssertEqual ['/bin/bash', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar') AssertEqual ['/bin/bash', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
endif endif
@ -54,3 +56,8 @@ Execute(cmd /s/c as a string should be used on Windows):
AssertEqual 'cmd /s/c "foobar"', ale#job#PrepareCommand(bufnr(''), 'foobar') AssertEqual 'cmd /s/c "foobar"', ale#job#PrepareCommand(bufnr(''), 'foobar')
endif endif
Execute(Setting ale_shell should cause ale#job#PrepareCommand to use set shell):
let g:ale_shell = '/foo/bar'
AssertEqual ['/foo/bar', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), "foobar")