Add tests to lacheck linter
This commit is contained in:
parent
a6a8c90126
commit
5052eca5cb
@ -21,7 +21,7 @@ function! ale_linters#tex#lacheck#Handle(buffer, lines) abort
|
||||
|
||||
" lacheck follows `\input{}` commands. We are only interested in
|
||||
" reporting errors for the current buffer only.
|
||||
if empty(matchstr(fnamemodify(l:match[1], ':t'), bufname(a:buffer)))
|
||||
if empty(matchstr(fnamemodify(l:match[1], ':t'), fnamemodify(bufname(a:buffer), ':t')))
|
||||
continue
|
||||
endif
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('tex', 'lacheck')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Executable should default to lacheck):
|
||||
AssertLinter 'lacheck', ale#Escape('lacheck') . ' %t'
|
||||
|
||||
Execute(Should be able to set a custom executable):
|
||||
let g:ale_tex_lacheck_executable = 'bin/foo'
|
||||
|
||||
AssertLinter 'bin/foo' , ale#Escape('bin/foo') . ' %t'
|
0
test/command_callback/tex_paths/sample1.tex
Normal file
0
test/command_callback/tex_paths/sample1.tex
Normal file
0
test/command_callback/tex_paths/sample2.tex
Normal file
0
test/command_callback/tex_paths/sample2.tex
Normal file
36
test/handler/test_lacheck_handler.vader
Normal file
36
test/handler/test_lacheck_handler.vader
Normal file
@ -0,0 +1,36 @@
|
||||
Before:
|
||||
runtime ale_linters/tex/lacheck.vim
|
||||
call ale#test#SetDirectory('/testplugin/test')
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The lacheck handler should parse lines correctly):
|
||||
|
||||
call ale#test#SetFilename('command_callback/tex_paths/sample1.tex')
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 1,
|
||||
\ 'type': 'W',
|
||||
\ 'text': 'perhaps you should insert a `~'' before "\ref"'
|
||||
\ }
|
||||
\ ],
|
||||
\ ale_linters#tex#lacheck#Handle(bufnr(''), [
|
||||
\ "** sample1:",
|
||||
\ "\"sample1.tex\", line 1: perhaps you should insert a `~' before \"\\ref\""
|
||||
\ ])
|
||||
|
||||
Execute(The lacheck handler should ignore errors from input files):
|
||||
|
||||
call ale#test#SetFilename('ale_test.tex')
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ ],
|
||||
\ ale_linters#tex#lacheck#Handle(255, [
|
||||
\ "** ale_input:",
|
||||
\ "\"ale_input.tex\", line 1: perhaps you should insert a `~' before \"\\ref\""
|
||||
\ ])
|
Loading…
Reference in New Issue
Block a user