mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-07 21:24:33 +08:00
Massively reduce the amount of code needed for linter tests
This commit is contained in:
@@ -1,35 +1,19 @@
|
||||
Before:
|
||||
Save g:ale_markdown_mdl_executable
|
||||
Save g:ale_markdown_mdl_options
|
||||
|
||||
unlet! g:ale_markdown_mdl_executable
|
||||
unlet! g:ale_markdown_mdl_options
|
||||
|
||||
runtime ale_linters/markdown/mdl.vim
|
||||
call ale#assert#SetUpLinterTest('markdown', 'mdl')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertEqual ale_linters#markdown#mdl#GetExecutable(bufnr('')), 'mdl'
|
||||
AssertEqual
|
||||
\ ale_linters#markdown#mdl#GetCommand(bufnr('')),
|
||||
\ ale#Escape('mdl')
|
||||
AssertLinter 'mdl', ale#Escape('mdl')
|
||||
|
||||
Execute(The executable and options should be configurable):
|
||||
let g:ale_markdown_mdl_executable = 'foo bar'
|
||||
let g:ale_markdown_mdl_options = '--wat'
|
||||
|
||||
AssertEqual ale_linters#markdown#mdl#GetExecutable(bufnr('')), 'foo bar'
|
||||
AssertEqual
|
||||
\ ale_linters#markdown#mdl#GetCommand(bufnr('')),
|
||||
\ ale#Escape('foo bar') . ' --wat'
|
||||
AssertLinter 'foo bar', ale#Escape('foo bar') . ' --wat'
|
||||
|
||||
Execute(Setting bundle appends 'exec mdl'):
|
||||
let g:ale_markdown_mdl_executable = 'path to/bundle'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('path to/bundle') . ' exec mdl',
|
||||
\ ale_linters#markdown#mdl#GetCommand(bufnr(''))
|
||||
AssertLinter 'path to/bundle', ale#Escape('path to/bundle') . ' exec mdl'
|
||||
|
||||
Reference in New Issue
Block a user