diff options
author | w0rp <devw0rp@gmail.com> | 2017-08-28 19:16:23 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-08-28 19:16:23 +0100 |
commit | b031531e79d409af3b143a1f40431cd868cd78fb (patch) | |
tree | 43109aa362992890041ec486fdc2f64bdb14325d /test/command_callback | |
parent | 73ec83d055a62019c41e699981e841e395219cca (diff) | |
download | ale-b031531e79d409af3b143a1f40431cd868cd78fb.zip |
#869 - Detect the shell dialect from the hashbang for shellcheck
Diffstat (limited to 'test/command_callback')
-rw-r--r-- | test/command_callback/test_shellcheck_command_callback.vader | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/command_callback/test_shellcheck_command_callback.vader b/test/command_callback/test_shellcheck_command_callback.vader new file mode 100644 index 00000000..0d8fef66 --- /dev/null +++ b/test/command_callback/test_shellcheck_command_callback.vader @@ -0,0 +1,47 @@ +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 + +After: + Restore + + unlet! b:ale_sh_shellcheck_exclusions + unlet! b:ale_sh_shellcheck_executable + unlet! b:ale_sh_shellcheck_options + unlet! b:is_bash + + call ale#linter#Reset() + +Execute(The default shellcheck command should be correct): + AssertEqual + \ 'shellcheck -f gcc -', + \ ale_linters#sh#shellcheck#GetCommand(bufnr('')) + +Execute(The shellcheck command should accept options): + let b:ale_sh_shellcheck_options = '--foobar' + + AssertEqual + \ 'shellcheck --foobar -f gcc -', + \ 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 + \ 'shellcheck --foobar -e foo,bar -f gcc -', + \ ale_linters#sh#shellcheck#GetCommand(bufnr('')) + +Execute(The shellcheck command should include the dialect): + let b:is_bash = 1 + + AssertEqual + \ 'shellcheck -s bash -f gcc -', + \ ale_linters#sh#shellcheck#GetCommand(bufnr('')) |