mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 20:54:26 +08:00
Simplfiy zlint configuration and tests
This commit is contained in:
@@ -22,13 +22,9 @@ function! ale_linters#zig#zlint#Handle(buffer, lines) abort
|
|||||||
return l:output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#zig#zlint#GetCommand(buffer) abort
|
|
||||||
return ale#Escape(ale#Var(a:buffer, 'zig_zlint_executable')) . ' %s -f gh'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('zig', {
|
call ale#linter#Define('zig', {
|
||||||
\ 'name': 'zlint',
|
\ 'name': 'zlint',
|
||||||
\ 'executable': {b -> ale#Var(b, "zig_zlint_executable")},
|
\ 'executable': {b -> ale#Var(b, "zig_zlint_executable")},
|
||||||
\ 'command': function('ale_linters#zig#zlint#GetCommand'),
|
\ 'command': '%e %s -f gh',
|
||||||
\ 'callback': 'ale_linters#zig#zlint#Handle',
|
\ 'callback': 'ale_linters#zig#zlint#Handle',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -5,15 +5,11 @@ After:
|
|||||||
call ale#assert#TearDownLinterTest()
|
call ale#assert#TearDownLinterTest()
|
||||||
|
|
||||||
Execute(The zlint executable and command should be configured correctly):
|
Execute(The zlint executable and command should be configured correctly):
|
||||||
|
AssertLinter 'zlint', ale#Escape('zlint') . ' %s -f gh'
|
||||||
|
|
||||||
" Set a custom executable path
|
" Set a custom executable path
|
||||||
let g:ale_zig_zlint_executable = '/custom/path/to/zlint'
|
let g:ale_zig_zlint_executable = '/custom/path/to/zlint'
|
||||||
|
|
||||||
" Create a buffer with Zig filetype
|
AssertLinter
|
||||||
call ale#test#SetFilename('test.zig')
|
\ '/custom/path/to/zlint',
|
||||||
|
\ ale#Escape('/custom/path/to/zlint') . ' %s -f gh'
|
||||||
" Check the executable
|
|
||||||
AssertEqual '/custom/path/to/zlint', ale#Var(bufnr(''), 'zig_zlint_executable')
|
|
||||||
|
|
||||||
" Check the command
|
|
||||||
let cmd = ale_linters#zig#zlint#GetCommand(bufnr(''))
|
|
||||||
AssertEqual ale#Escape('/custom/path/to/zlint') . ' %s -f gh', cmd
|
|
||||||
|
|||||||
Reference in New Issue
Block a user