Add tests for LSP responses
This commit is contained in:
parent
85b3a4a5c6
commit
33b4a90507
1 changed files with 87 additions and 0 deletions
|
@ -244,6 +244,93 @@ Execute(tsserver errors should mark tsserver no longer active):
|
|||
|
||||
AssertEqual [], g:ale_buffer_info[bufnr('')].active_linter_list
|
||||
|
||||
Execute(LSP diagnostics responses should be handled correctly):
|
||||
let b:ale_linters = ['eclipselsp']
|
||||
runtime ale_linters/java/eclipselsp.vim
|
||||
call ale#test#SetFilename('filename.java')
|
||||
call ale#engine#InitBufferInfo(bufnr(''))
|
||||
call ale#lsp_linter#SetLSPLinterMap({'1': 'eclipselsp'})
|
||||
|
||||
call ale#lsp_linter#HandleLSPResponse(1, {
|
||||
\ 'jsonrpc':'2.0',
|
||||
\ 'method':'textDocument/publishDiagnostics',
|
||||
\ 'params': {
|
||||
\ 'uri':'file://' . g:dir . '/filename.java',
|
||||
\ 'diagnostics': [
|
||||
\ {
|
||||
\ 'range': {
|
||||
\ 'start': {
|
||||
\ 'line': 0,
|
||||
\ 'character':0
|
||||
\ },
|
||||
\ 'end': {
|
||||
\ 'line': 0,
|
||||
\ 'character':0
|
||||
\ }
|
||||
\ },
|
||||
\ 'severity': 2,
|
||||
\ 'code': "",
|
||||
\ 'source': 'Java',
|
||||
\ 'message': 'Missing JRE 1-8'
|
||||
\ }
|
||||
\ ]
|
||||
\ }
|
||||
\})
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 1,
|
||||
\ 'bufnr': 3,
|
||||
\ 'col': 1,
|
||||
\ 'pattern': '',
|
||||
\ 'valid': 1,
|
||||
\ 'vcol': 0,
|
||||
\ 'nr': -1,
|
||||
\ 'type': 'W',
|
||||
\ 'text': 'Missing JRE 1-8'
|
||||
\ }
|
||||
\ ],
|
||||
\ ale#test#GetLoclistWithoutModule()
|
||||
|
||||
Execute(LSP diagnostics responses on project root should not populate loclist):
|
||||
let b:ale_linters = ['eclipselsp']
|
||||
runtime ale_linters/java/eclipselsp.vim
|
||||
call ale#test#SetFilename('filename.java')
|
||||
call ale#engine#InitBufferInfo(bufnr(''))
|
||||
call ale#lsp_linter#SetLSPLinterMap({'1': 'eclipselsp'})
|
||||
|
||||
call ale#lsp_linter#HandleLSPResponse(1, {
|
||||
\ 'jsonrpc':'2.0',
|
||||
\ 'method':'textDocument/publishDiagnostics',
|
||||
\ 'params': {
|
||||
\ 'uri':'file://' . g:dir,
|
||||
\ 'diagnostics': [
|
||||
\ {
|
||||
\ 'range': {
|
||||
\ 'start': {
|
||||
\ 'line': 0,
|
||||
\ 'character':0
|
||||
\ },
|
||||
\ 'end': {
|
||||
\ 'line': 0,
|
||||
\ 'character':0
|
||||
\ }
|
||||
\ },
|
||||
\ 'severity': 2,
|
||||
\ 'code': "",
|
||||
\ 'source': 'Java',
|
||||
\ 'message': 'Missing JRE 1-8'
|
||||
\ }
|
||||
\ ]
|
||||
\ }
|
||||
\})
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ ],
|
||||
\ ale#test#GetLoclistWithoutModule()
|
||||
|
||||
Execute(LSP errors should mark linters no longer active):
|
||||
let b:ale_linters = ['pyls']
|
||||
runtime ale_linters/python/pyls.vim
|
||||
|
|
Reference in a new issue