diff options
Diffstat (limited to 'test/command_callback')
3 files changed, 68 insertions, 9 deletions
diff --git a/test/command_callback/test_flake8_command_callback.vader b/test/command_callback/test_flake8_command_callback.vader index f082a63a..09f64ee3 100644 --- a/test/command_callback/test_flake8_command_callback.vader +++ b/test/command_callback/test_flake8_command_callback.vader @@ -34,13 +34,52 @@ Execute(The flake8 callbacks should return the correct default values): \] Execute(The option for disabling changing directories should work): - let g:ale_python_flake8_change_directory = 0 + let g:ale_python_flake8_change_directory = 'off' AssertLinter 'flake8', [ \ ale#Escape('flake8') . ' --version', \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -', \] + let g:ale_python_flake8_change_directory = 0 + + AssertLinter 'flake8', [ + \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -', + \] + + " Invalid options should be considered the same as turning the setting off. + let g:ale_python_flake8_change_directory = 'xxx' + + AssertLinter 'flake8', [ + \ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -', + \] + +Execute(The option for changing directory to project root should work): + silent execute 'file ' . fnameescape(g:dir . '/python_paths/namespace_package_tox/namespace/foo/bar.py') + + AssertLinter 'flake8', [ + \ ale#Escape('flake8') . ' --version', + \ ale#path#CdString(ale#python#FindProjectRootIni(bufnr(''))) + \ . ale#Escape('flake8') . ' --format=default --stdin-display-name %s -', + \] + +Execute(The option for changing directory to file dir should work): + let g:ale_python_flake8_change_directory = 'file' + silent execute 'file ' . fnameescape(g:dir . '/python_paths/namespace_package_tox/namespace/foo/bar.py') + + AssertLinter 'flake8', [ + \ ale#Escape('flake8') . ' --version', + \ ale#path#BufferCdString(bufnr('')) + \ . ale#Escape('flake8') . ' --format=default --stdin-display-name %s -', + \] + + let g:ale_python_flake8_change_directory = 1 + + AssertLinter 'flake8', [ + \ ale#path#BufferCdString(bufnr('')) + \ . ale#Escape('flake8') . ' --format=default --stdin-display-name %s -', + \] + Execute(The flake8 command callback should let you set options): let g:ale_python_flake8_options = '--some-option' @@ -163,5 +202,5 @@ Execute(Pipenv is detected when python_flake8_auto_pipenv is set): call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py') AssertLinter 'pipenv', - \ ale#path#BufferCdString(bufnr('')) + \ ale#path#CdString(ale#python#FindProjectRootIni(bufnr(''))) \ . ale#Escape('pipenv') . ' run flake8 --format=default --stdin-display-name %s -' diff --git a/test/command_callback/test_psalm_command_callbacks.vader b/test/command_callback/test_psalm_command_callbacks.vader index 70b5af95..d32780e6 100644 --- a/test/command_callback/test_psalm_command_callbacks.vader +++ b/test/command_callback/test_psalm_command_callbacks.vader @@ -2,6 +2,9 @@ Before: call ale#assert#SetUpLinterTest('php', 'psalm') After: + unlet! g:i + unlet! g:matched + if isdirectory(g:dir . '/.git') call delete(g:dir . '/.git', 'd') endif @@ -22,19 +25,36 @@ Execute(Vendor executables should be detected): \ . '/psalm-project/vendor/bin/psalm' \ )) . ' --language-server' + let g:ale_php_psalm_use_global = 1 + + AssertLinter 'psalm', + \ ale#Escape('psalm') . ' --language-server' + Execute(User provided options should be used): - let g:ale_psalm_langserver_options = '--my-user-provided-option my-value' + let g:ale_php_psalm_options = '--my-user-provided-option my-value' AssertLinter 'psalm', \ ale#Escape('psalm') \ . ' --language-server --my-user-provided-option my-value' - Execute(The project path should be correct for .git directories): call ale#test#SetFilename('psalm-project/test.php') + let g:matched = 0 - if !isdirectory(g:dir . '/.git') - call mkdir(g:dir . '/.git') - endif + for g:i in range(4) + if !isdirectory(g:dir . '/.git') + call mkdir(g:dir . '/.git') + endif + + try + AssertLSPProject g:dir + catch /.+/ + endtry - AssertLSPProject g:dir + let g:matched = 1 + break + endfor + + if !g:matched + AssertLSPProject g:dir + endif diff --git a/test/command_callback/test_vint_command_callback.vader b/test/command_callback/test_vint_command_callback.vader index e0051f26..4ce277e8 100644 --- a/test/command_callback/test_vint_command_callback.vader +++ b/test/command_callback/test_vint_command_callback.vader @@ -1,7 +1,7 @@ Before: call ale#assert#SetUpLinterTest('vim', 'vint') let b:command_tail = (has('nvim') ? ' --enable-neovim' : '') - \ . ' -f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})" %t' + \ . ' -f "{file_path}:{line_number}:{column_number}: {severity}: {policy_name} - {description} (see {reference})" %t' After: unlet! b:bin_dir |