diff options
author | Bartek thindil Jasicki <thindil@laeran.pl> | 2020-09-11 10:38:36 +0200 |
---|---|---|
committer | Bartek thindil Jasicki <thindil@laeran.pl> | 2020-09-11 10:38:36 +0200 |
commit | 1781b1eab0f9c8e6dd5beca302bd9cd430d7f7b2 (patch) | |
tree | 877345d38bc61e2b492e5f04336f1cdb564d7c7e /test/command_callback | |
parent | c78be861035765d268a5533cf583803e22d56d1c (diff) | |
parent | 08295ce17405cb5f6c80d2f726262493bfd21210 (diff) | |
download | ale-1781b1eab0f9c8e6dd5beca302bd9cd430d7f7b2.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'test/command_callback')
3 files changed, 54 insertions, 17 deletions
diff --git a/test/command_callback/test_embertemplatelint_command_callbacks.vader b/test/command_callback/test_embertemplatelint_command_callbacks.vader new file mode 100644 index 00000000..97687d29 --- /dev/null +++ b/test/command_callback/test_embertemplatelint_command_callbacks.vader @@ -0,0 +1,17 @@ +Before: + call ale#assert#SetUpLinterTest('handlebars', 'embertemplatelint') + + GivenCommandOutput ['1.6.0'] + +After: + call ale#assert#TearDownLinterTest() + +Execute(ember-template-lint executables runs the right command): + AssertLinter 'ember-template-lint', + \ ale#Escape('ember-template-lint') . ' --json --filename %s' + +Execute(old ember-template-lint executables runs the right command): + GivenCommandOutput [] + + AssertLinter 'ember-template-lint', + \ ale#Escape('ember-template-lint') . ' --json %t' diff --git a/test/command_callback/test_pylint_command_callback.vader b/test/command_callback/test_pylint_command_callback.vader index 755dd292..15f004b6 100644 --- a/test/command_callback/test_pylint_command_callback.vader +++ b/test/command_callback/test_pylint_command_callback.vader @@ -8,6 +8,8 @@ Before: let b:bin_dir = has('win32') ? 'Scripts' : 'bin' let b:command_tail = ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s' + GivenCommandOutput ['pylint 2.3.0'] + After: unlet! b:bin_dir unlet! b:executable @@ -17,26 +19,33 @@ After: Execute(The pylint callbacks should return the correct default values): AssertLinter 'pylint', - \ ale#path#CdString(expand('#' . bufnr('') . ':p:h')) - \ . ale#Escape('pylint') . ' ' . b:command_tail + \ ale#path#CdString(expand('%:p:h')) + \ . ale#Escape('pylint') . b:command_tail + +Execute(Pylint should run with the --from-stdin in new enough versions): + GivenCommandOutput ['pylint 2.4.0'] + + AssertLinter 'pylint', + \ ale#path#CdString(expand('%:p:h')) + \ . ale#Escape('pylint') . b:command_tail[:-3] . '--from-stdin %s' Execute(The option for disabling changing directories should work): let g:ale_python_pylint_change_directory = 0 - AssertLinter 'pylint', ale#Escape('pylint') . ' ' . b:command_tail + AssertLinter 'pylint', ale#Escape('pylint') . b:command_tail Execute(The pylint executable should be configurable, and escaped properly): let g:ale_python_pylint_executable = 'executable with spaces' AssertLinter 'executable with spaces', - \ ale#path#CdString(expand('#' . bufnr('') . ':p:h')) - \ . ale#Escape('executable with spaces') . ' ' . b:command_tail + \ ale#path#CdString(expand('%:p:h')) + \ . ale#Escape('executable with spaces') . b:command_tail Execute(The pylint command callback should let you set options): let g:ale_python_pylint_options = '--some-option' AssertLinter 'pylint', - \ ale#path#CdString(expand('#' . bufnr('') . ':p:h')) + \ ale#path#CdString(expand('%:p:h')) \ . ale#Escape('pylint') . ' --some-option' . b:command_tail Execute(The pylint callbacks shouldn't detect virtualenv directories where they don't exist): @@ -44,7 +53,7 @@ Execute(The pylint callbacks shouldn't detect virtualenv directories where they AssertLinter 'pylint', \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/no_virtualenv/subdir')) - \ . ale#Escape('pylint') . ' ' . b:command_tail + \ . ale#Escape('pylint') . b:command_tail Execute(The pylint callbacks should detect virtualenv directories): silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py') @@ -55,7 +64,7 @@ Execute(The pylint callbacks should detect virtualenv directories): AssertLinter b:executable, \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir')) - \ . ale#Escape(b:executable) . ' ' . b:command_tail + \ . ale#Escape(b:executable) . b:command_tail Execute(You should able able to use the global pylint instead): silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py') @@ -63,7 +72,7 @@ Execute(You should able able to use the global pylint instead): AssertLinter 'pylint', \ ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir')) - \ . ale#Escape('pylint') . ' ' . b:command_tail + \ . ale#Escape('pylint') . b:command_tail Execute(Setting executable to 'pipenv' appends 'run pylint'): let g:ale_python_pylint_executable = 'path/to/pipenv' @@ -71,7 +80,7 @@ Execute(Setting executable to 'pipenv' appends 'run pylint'): AssertLinter 'path/to/pipenv', \ ale#path#CdString(expand('#' . bufnr('') . ':p:h')) \ . ale#Escape('path/to/pipenv') . ' run pylint' - \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s' + \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s' Execute(Pipenv is detected when python_pylint_auto_pipenv is set): let g:ale_python_pylint_auto_pipenv = 1 @@ -80,4 +89,4 @@ Execute(Pipenv is detected when python_pylint_auto_pipenv is set): AssertLinter 'pipenv', \ ale#path#CdString(expand('#' . bufnr('') . ':p:h')) \ . ale#Escape('pipenv') . ' run pylint' - \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s' + \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s' diff --git a/test/command_callback/test_vint_command_callback.vader b/test/command_callback/test_vint_command_callback.vader index 4ce277e8..4a224d01 100644 --- a/test/command_callback/test_vint_command_callback.vader +++ b/test/command_callback/test_vint_command_callback.vader @@ -1,17 +1,17 @@ Before: call ale#assert#SetUpLinterTest('vim', 'vint') - let b:command_tail = (has('nvim') ? ' --enable-neovim' : '') - \ . ' -f "{file_path}:{line_number}:{column_number}: {severity}: {policy_name} - {description} (see {reference})" %t' + let b:common_flags = (has('nvim') ? ' --enable-neovim' : '') + \ . ' -f "{file_path}:{line_number}:{column_number}: {severity}: {policy_name} - {description} (see {reference})"' After: - unlet! b:bin_dir - unlet! b:executable + unlet! b:common_flags + call ale#assert#TearDownLinterTest() Execute(The default command should be correct): AssertLinter 'vint', [ \ ale#Escape('vint') .' --version', - \ ale#Escape('vint') .' -s --no-color' . b:command_tail, + \ ale#Escape('vint') .' -s --no-color' . b:common_flags . ' %t', \] Execute(The executable should be configurable): @@ -19,5 +19,16 @@ Execute(The executable should be configurable): AssertLinter 'foobar', [ \ ale#Escape('foobar') .' --version', - \ ale#Escape('foobar') .' -s --no-color' . b:command_tail, + \ ale#Escape('foobar') .' -s --no-color' . b:common_flags . ' %t', \] + +Execute(The --no-color flag should not be used for older Vint versions): + GivenCommandOutput ['v0.3.5'] + + AssertLinter 'vint', ale#Escape('vint') .' -s' . b:common_flags . ' %t' + +Execute(--stdin-display-name should be used in newer versions): + GivenCommandOutput ['v0.4.0'] + + AssertLinter 'vint', ale#Escape('vint') .' -s --no-color' . b:common_flags + \ . ' --stdin-display-name %s -' |