Add tests for covering the coming Vint version

This commit is contained in:
w0rp 2020-09-09 20:34:27 +01:00
parent 62fd83f1dd
commit 78fa93bd55
No known key found for this signature in database
GPG Key ID: 0FC1ECAA8C81CD83
1 changed files with 17 additions and 6 deletions

View File

@ -1,17 +1,17 @@
Before: Before:
call ale#assert#SetUpLinterTest('vim', 'vint') call ale#assert#SetUpLinterTest('vim', 'vint')
let b:command_tail = (has('nvim') ? ' --enable-neovim' : '') let b:common_flags = (has('nvim') ? ' --enable-neovim' : '')
\ . ' -f "{file_path}:{line_number}:{column_number}: {severity}: {policy_name} - {description} (see {reference})" %t' \ . ' -f "{file_path}:{line_number}:{column_number}: {severity}: {policy_name} - {description} (see {reference})"'
After: After:
unlet! b:bin_dir unlet! b:common_flags
unlet! b:executable
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The default command should be correct): Execute(The default command should be correct):
AssertLinter 'vint', [ AssertLinter 'vint', [
\ ale#Escape('vint') .' --version', \ 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): Execute(The executable should be configurable):
@ -19,5 +19,16 @@ Execute(The executable should be configurable):
AssertLinter 'foobar', [ AssertLinter 'foobar', [
\ ale#Escape('foobar') .' --version', \ 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 -'