diff options
author | w0rp <devw0rp@gmail.com> | 2021-03-01 20:11:10 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2021-03-01 20:11:10 +0000 |
commit | 9fe7b1fe6a23fb55e6d782293585d58193123f59 (patch) | |
tree | 0403deb70011aee7be08e586b10b5828cf69499e /test/command_callback/test_shellcheck_command_callback.vader | |
parent | 48fab99a0ab793e1b9607795c21659f12bd6947f (diff) | |
download | ale-9fe7b1fe6a23fb55e6d782293585d58193123f59.zip |
Close #2281 - Separate cwd commands from commands
Working directories are now set seperately from the commands so they
can later be swapped out when running linters over projects is
supported, and also better support filename mapping for running linters
on other machines in future.
Diffstat (limited to 'test/command_callback/test_shellcheck_command_callback.vader')
-rw-r--r-- | test/command_callback/test_shellcheck_command_callback.vader | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/test/command_callback/test_shellcheck_command_callback.vader b/test/command_callback/test_shellcheck_command_callback.vader index 9fb5303a..40995755 100644 --- a/test/command_callback/test_shellcheck_command_callback.vader +++ b/test/command_callback/test_shellcheck_command_callback.vader @@ -2,67 +2,63 @@ Before: call ale#assert#SetUpLinterTest('sh', 'shellcheck') call ale#test#SetFilename('test.sh') - let b:prefix = ale#path#BufferCdString(bufnr('')) let b:suffix = ' -f gcc -' After: unlet! b:is_bash - unlet! b:prefix unlet! b:suffix call ale#assert#TearDownLinterTest() Execute(The default shellcheck command should be correct): - AssertLinter 'shellcheck', b:prefix . ale#Escape('shellcheck') . b:suffix + AssertLinterCwd '%s:h' + AssertLinter 'shellcheck', ale#Escape('shellcheck') . b:suffix Execute(The option disabling changing directories should work): let g:ale_sh_shellcheck_change_directory = 0 + AssertLinterCwd '' AssertLinter 'shellcheck', ale#Escape('shellcheck') . b:suffix Execute(The shellcheck command should accept options): let b:ale_sh_shellcheck_options = '--foobar' - AssertLinter 'shellcheck', - \ b:prefix . ale#Escape('shellcheck') . ' --foobar' . b:suffix + AssertLinter 'shellcheck', ale#Escape('shellcheck') . ' --foobar' . b:suffix Execute(The shellcheck command should accept options and exclusions): let b:ale_sh_shellcheck_options = '--foobar' let b:ale_sh_shellcheck_exclusions = 'foo,bar' AssertLinter 'shellcheck', - \ b:prefix . ale#Escape('shellcheck') . ' --foobar -e foo,bar' . b:suffix + \ ale#Escape('shellcheck') . ' --foobar -e foo,bar' . b:suffix Execute(The shellcheck command should include the dialect): let b:is_bash = 1 - AssertLinter 'shellcheck', - \ b:prefix . ale#Escape('shellcheck') . ' -s bash' . b:suffix + AssertLinter 'shellcheck', ale#Escape('shellcheck') . ' -s bash' . b:suffix Execute(The shellcheck command should use ale_sh_shellcheck_dialect): let b:ale_sh_shellcheck_dialect = 'ksh93' - AssertLinter 'shellcheck', - \ b:prefix . ale#Escape('shellcheck') . ' -s ksh93' . b:suffix + AssertLinter 'shellcheck', ale#Escape('shellcheck') . ' -s ksh93' . b:suffix Execute(The shellcheck command should allow unspecified dialect): let b:ale_sh_shellcheck_dialect = '' - AssertLinter 'shellcheck', - \ b:prefix . ale#Escape('shellcheck') . b:suffix + AssertLinter 'shellcheck', ale#Escape('shellcheck') . b:suffix 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' - AssertLinter 'shellcheck', b:prefix . ale#Escape('shellcheck') + AssertLinter 'shellcheck', ale#Escape('shellcheck') \ . ' -s bash --foobar -e foo,bar' \ . b:suffix Execute(The -x option should be added when the version is new enough): AssertLinter 'shellcheck', [ \ ale#Escape('shellcheck') . ' --version', - \ b:prefix . ale#Escape('shellcheck') . b:suffix, + \ ale#Escape('shellcheck') . b:suffix, \] GivenCommandOutput [ @@ -73,13 +69,13 @@ Execute(The -x option should be added when the version is new enough): \] AssertLinter 'shellcheck', [ \ ale#Escape('shellcheck') . ' --version', - \ b:prefix . ale#Escape('shellcheck') . ' -x' . b:suffix, + \ ale#Escape('shellcheck') . ' -x' . b:suffix, \] " We should cache the version check GivenCommandOutput [] AssertLinter 'shellcheck', [ - \ b:prefix . ale#Escape('shellcheck') . ' -x' . b:suffix, + \ ale#Escape('shellcheck') . ' -x' . b:suffix, \] Execute(The -x option should not be added when the version is too old): @@ -91,7 +87,7 @@ Execute(The -x option should not be added when the version is too old): \] AssertLinter 'shellcheck', [ \ ale#Escape('shellcheck') . ' --version', - \ b:prefix . ale#Escape('shellcheck') . b:suffix, + \ ale#Escape('shellcheck') . b:suffix, \] Execute(The version check shouldn't be run again for old versions): @@ -103,8 +99,8 @@ Execute(The version check shouldn't be run again for old versions): \] AssertLinter 'shellcheck', [ \ ale#Escape('shellcheck') . ' --version', - \ b:prefix . ale#Escape('shellcheck') . b:suffix, + \ ale#Escape('shellcheck') . b:suffix, \] AssertLinter 'shellcheck', [ - \ b:prefix . ale#Escape('shellcheck') . b:suffix, + \ ale#Escape('shellcheck') . b:suffix, \] |