2017-08-28 14:16:23 -04:00
|
|
|
Before:
|
|
|
|
Save g:ale_sh_shellcheck_exclusions
|
|
|
|
Save g:ale_sh_shellcheck_executable
|
|
|
|
Save g:ale_sh_shellcheck_options
|
|
|
|
|
|
|
|
unlet! g:ale_sh_shellcheck_exclusions
|
|
|
|
unlet! g:ale_sh_shellcheck_executable
|
|
|
|
unlet! g:ale_sh_shellcheck_options
|
|
|
|
|
|
|
|
runtime ale_linters/sh/shellcheck.vim
|
|
|
|
|
2017-10-25 19:48:51 -04:00
|
|
|
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
|
|
|
call ale#test#SetFilename('test.sh')
|
|
|
|
|
|
|
|
let b:prefix = 'cd ' . ale#Escape(ale#path#Winify(g:dir)) . ' && '
|
|
|
|
let b:suffix = ' -x -f gcc -'
|
|
|
|
|
2017-08-28 14:16:23 -04:00
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
|
|
|
unlet! b:ale_sh_shellcheck_exclusions
|
|
|
|
unlet! b:ale_sh_shellcheck_executable
|
|
|
|
unlet! b:ale_sh_shellcheck_options
|
|
|
|
unlet! b:is_bash
|
2017-10-25 19:48:51 -04:00
|
|
|
unlet! b:prefix
|
|
|
|
|
|
|
|
call ale#test#RestoreDirectory()
|
2017-08-28 14:16:23 -04:00
|
|
|
|
|
|
|
call ale#linter#Reset()
|
|
|
|
|
|
|
|
Execute(The default shellcheck command should be correct):
|
|
|
|
AssertEqual
|
2017-10-25 19:48:51 -04:00
|
|
|
\ b:prefix . ale#Escape('shellcheck') . b:suffix,
|
2017-08-28 14:16:23 -04:00
|
|
|
\ ale_linters#sh#shellcheck#GetCommand(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The shellcheck command should accept options):
|
|
|
|
let b:ale_sh_shellcheck_options = '--foobar'
|
|
|
|
|
|
|
|
AssertEqual
|
2017-10-25 19:48:51 -04:00
|
|
|
\ b:prefix . ale#Escape('shellcheck') . ' --foobar' . b:suffix,
|
2017-08-28 14:16:23 -04:00
|
|
|
\ ale_linters#sh#shellcheck#GetCommand(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The shellcheck command should accept options and exclusions):
|
|
|
|
let b:ale_sh_shellcheck_options = '--foobar'
|
|
|
|
let b:ale_sh_shellcheck_exclusions = 'foo,bar'
|
|
|
|
|
|
|
|
AssertEqual
|
2017-10-25 19:48:51 -04:00
|
|
|
\ b:prefix . ale#Escape('shellcheck') . ' --foobar -e foo,bar' . b:suffix,
|
2017-08-28 14:16:23 -04:00
|
|
|
\ ale_linters#sh#shellcheck#GetCommand(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The shellcheck command should include the dialect):
|
|
|
|
let b:is_bash = 1
|
|
|
|
|
|
|
|
AssertEqual
|
2017-10-25 19:48:51 -04:00
|
|
|
\ b:prefix . ale#Escape('shellcheck') . ' -s bash' . b:suffix,
|
2017-08-28 14:16:23 -04:00
|
|
|
\ ale_linters#sh#shellcheck#GetCommand(bufnr(''))
|
2017-09-22 17:37:12 -04:00
|
|
|
|
|
|
|
Execute(The shellcheck command should include the dialect before options and exclusions):
|
|
|
|
let b:is_bash = 1
|
|
|
|
let b:ale_sh_shellcheck_options = '--foobar'
|
|
|
|
let b:ale_sh_shellcheck_exclusions = 'foo,bar'
|
|
|
|
|
|
|
|
AssertEqual
|
2017-10-25 19:48:51 -04:00
|
|
|
\ b:prefix
|
|
|
|
\ . ale#Escape('shellcheck')
|
|
|
|
\ . ' -s bash --foobar -e foo,bar'
|
|
|
|
\ . b:suffix,
|
2017-09-22 17:37:12 -04:00
|
|
|
\ ale_linters#sh#shellcheck#GetCommand(bufnr(''))
|