This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
ale/test/test_prepare_command.vader

76 lines
2.1 KiB
Text
Raw Permalink Normal View History

Before:
Save &shell
Save &shellcmdflag
Save g:ale_shell
Save g:ale_shell_arguments
unlet! g:ale_shell
unlet! g:ale_shell_arguments
After:
Restore
Execute(sh should be used when the shell is fish):
if !has('win32')
" Set something else, so we will replace that too.
let &shellcmdflag = '-f'
let &shell = 'fish'
AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
let &shell = '/usr/bin/fish'
AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
let &shell = '/usr/local/bin/fish'
AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
endif
Execute(sh should be used when the shell is powershell):
if !has('win32')
" Set something else, so we will replace that too.
let &shellcmdflag = '-f'
let &shell = 'pwsh'
AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
let &shell = '/usr/bin/pwsh'
AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
let &shell = '/usr/local/bin/pwsh'
AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
endif
Execute(Other shells should be used when set):
if !has('win32')
let &shell = '/bin/bash'
let &shellcmdflag = '-c'
2018-12-28 16:58:55 +00:00
let g:ale_shell = &shell
AssertEqual ['/bin/bash', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
endif
Execute(cmd /s/c as a string should be used on Windows):
if has('win32')
let &shell = 'who cares'
let &shellcmdflag = 'whatever'
AssertEqual 'cmd /s/c "foobar"', ale#job#PrepareCommand(bufnr(''), 'foobar')
endif
2018-12-28 16:58:55 +00:00
Execute(Setting ale_shell should cause ale#job#PrepareCommand to use set shell):
let g:ale_shell = '/foo/bar'
2018-12-28 16:58:55 +00:00
2019-01-04 14:51:55 +00:00
if has('win32')
AssertEqual ['/foo/bar', '/c', 'foobar'], ale#job#PrepareCommand(bufnr(''), "foobar")
else
AssertEqual ['/foo/bar', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), "foobar")
endif
let g:ale_shell_arguments = '-x'
AssertEqual ['/foo/bar', '-x', 'foobar'], ale#job#PrepareCommand(bufnr(''), "foobar")