summaryrefslogtreecommitdiff
path: root/test/lsp/test_engine_lsp_response_handling.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2020-09-05 21:46:39 +0100
committerw0rp <devw0rp@gmail.com>2020-09-05 21:46:39 +0100
commit5bc49d204782617e01da65d83c0d9700a1b0a72f (patch)
tree4b9ba33d3a9788b92e1491a8c559dc6b5a4927b9 /test/lsp/test_engine_lsp_response_handling.vader
parent152b2cb6910d9173d75a195c5a185b7f3f8aa696 (diff)
downloadale-5bc49d204782617e01da65d83c0d9700a1b0a72f.zip
Fix #3183 - Escape filename characters from LSP/tsserver
Diffstat (limited to 'test/lsp/test_engine_lsp_response_handling.vader')
-rw-r--r--test/lsp/test_engine_lsp_response_handling.vader56
1 files changed, 46 insertions, 10 deletions
diff --git a/test/lsp/test_engine_lsp_response_handling.vader b/test/lsp/test_engine_lsp_response_handling.vader
index 9abfa087..8261f1da 100644
--- a/test/lsp/test_engine_lsp_response_handling.vader
+++ b/test/lsp/test_engine_lsp_response_handling.vader
@@ -44,9 +44,21 @@ After:
Given foobar(An empty file):
Execute(tsserver syntax error responses should be handled correctly):
runtime ale_linters/typescript/tsserver.vim
- call ale#test#SetFilename('filename.ts')
+
+ if has('win32')
+ call ale#test#SetFilename('filename,[]^$.ts')
+ else
+ call ale#test#SetFilename('filename*?,{}[]^$.ts')
+ endif
+
call ale#engine#InitBufferInfo(bufnr(''))
+ if has('win32')
+ AssertEqual 'filename,[]^$.ts', expand('%:p:t')
+ else
+ AssertEqual 'filename*?,{}[]^$.ts', expand('%:p:t')
+ endif
+
" When we get syntax errors and no semantic errors, we should keep the
" syntax errors.
call ale#lsp_linter#HandleLSPResponse(1, {
@@ -54,7 +66,7 @@ Execute(tsserver syntax error responses should be handled correctly):
\ 'type': 'event',
\ 'event': 'syntaxDiag',
\ 'body': {
- \ 'file': g:dir . '/filename.ts',
+ \ 'file': expand('%:p'),
\ 'diagnostics':[
\ {
\ 'start': {
@@ -76,7 +88,7 @@ Execute(tsserver syntax error responses should be handled correctly):
\ 'type': 'event',
\ 'event': 'semanticDiag',
\ 'body': {
- \ 'file': g:dir . '/filename.ts',
+ \ 'file': expand('%:p'),
\ 'diagnostics':[
\ ],
\ },
@@ -104,7 +116,7 @@ Execute(tsserver syntax error responses should be handled correctly):
\ 'type': 'event',
\ 'event': 'syntaxDiag',
\ 'body': {
- \ 'file': g:dir . '/filename.ts',
+ \ 'file': expand('%:p'),
\ 'diagnostics':[
\ ],
\ },
@@ -146,9 +158,21 @@ Execute(tsserver syntax error responses should be handled correctly):
Execute(tsserver semantic error responses should be handled correctly):
runtime ale_linters/typescript/tsserver.vim
- call ale#test#SetFilename('filename.ts')
+
+ if has('win32')
+ call ale#test#SetFilename('filename,[]^$.ts')
+ else
+ call ale#test#SetFilename('filename*?,{}[]^$.ts')
+ endif
+
call ale#engine#InitBufferInfo(bufnr(''))
+ if has('win32')
+ AssertEqual 'filename,[]^$.ts', expand('%:p:t')
+ else
+ AssertEqual 'filename*?,{}[]^$.ts', expand('%:p:t')
+ endif
+
" When we get syntax errors and no semantic errors, we should keep the
" syntax errors.
call ale#lsp_linter#HandleLSPResponse(1, {
@@ -156,7 +180,7 @@ Execute(tsserver semantic error responses should be handled correctly):
\ 'type': 'event',
\ 'event': 'syntaxDiag',
\ 'body': {
- \ 'file': g:dir . '/filename.ts',
+ \ 'file': expand('%:p'),
\ 'diagnostics':[
\ ],
\ },
@@ -166,7 +190,7 @@ Execute(tsserver semantic error responses should be handled correctly):
\ 'type': 'event',
\ 'event': 'semanticDiag',
\ 'body': {
- \ 'file': g:dir . '/filename.ts',
+ \ 'file': expand('%:p'),
\ 'diagnostics':[
\ {
\ 'start': {
@@ -206,7 +230,7 @@ Execute(tsserver semantic error responses should be handled correctly):
\ 'type': 'event',
\ 'event': 'semanticDiag',
\ 'body': {
- \ 'file': g:dir . '/filename.ts',
+ \ 'file': expand('%:p'),
\ 'diagnostics':[
\ ],
\ },
@@ -270,15 +294,27 @@ Execute(tsserver errors should mark tsserver no longer active):
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')
+
+ if has('win32')
+ call ale#test#SetFilename('filename,[]^$.ts')
+ else
+ call ale#test#SetFilename('filename*?,{}[]^$.java')
+ endif
+
call ale#engine#InitBufferInfo(bufnr(''))
call ale#lsp_linter#SetLSPLinterMap({'1': 'eclipselsp'})
+ if has('win32')
+ AssertEqual 'filename,[]^$.ts', expand('%:p:t')
+ else
+ AssertEqual 'filename*?,{}[]^$.java', expand('%:p:t')
+ endif
+
call ale#lsp_linter#HandleLSPResponse(1, {
\ 'jsonrpc':'2.0',
\ 'method':'textDocument/publishDiagnostics',
\ 'params': {
- \ 'uri':'file://' . g:dir . '/filename.java',
+ \ 'uri': ale#path#ToURI(expand('%:p')),
\ 'diagnostics': [
\ {
\ 'range': {