summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2018-08-02 19:22:45 +0100
committerGitHub <noreply@github.com>2018-08-02 19:22:45 +0100
commit5f024eda093dcce62159a6f262ffb084ccce4e51 (patch)
treef7ba243aeb9a0a8278071421ad2ec9a96a224a97 /test
parent589c8dbd94929a63006c5fee372e022f0f2b8417 (diff)
parent04362c746d7b73b03eb85d8936bd285a841a4704 (diff)
downloadale-5f024eda093dcce62159a6f262ffb084ccce4e51.zip
Merge pull request #1771 from fredemmott/lsp
Show LSP diagnostic codes for `%code%` in message formats
Diffstat (limited to 'test')
-rw-r--r--test/lsp/test_read_lsp_diagnostics.vader29
-rw-r--r--test/test_engine_lsp_response_handling.vader2
-rw-r--r--test/test_ignoring_linters.vader1
3 files changed, 29 insertions, 3 deletions
diff --git a/test/lsp/test_read_lsp_diagnostics.vader b/test/lsp/test_read_lsp_diagnostics.vader
index 444272aa..df187a24 100644
--- a/test/lsp/test_read_lsp_diagnostics.vader
+++ b/test/lsp/test_read_lsp_diagnostics.vader
@@ -18,7 +18,7 @@ Execute(ale#lsp#response#ReadDiagnostics() should handle errors):
\ 'col': 11,
\ 'end_lnum': 5,
\ 'end_col': 16,
- \ 'nr': 'some-error',
+ \ 'code': 'some-error',
\ }
\ ],
\ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [
@@ -39,7 +39,7 @@ Execute(ale#lsp#response#ReadDiagnostics() should handle warnings):
\ 'col': 4,
\ 'end_lnum': 2,
\ 'end_col': 4,
- \ 'nr': 'some-warning',
+ \ 'code': 'some-warning',
\ }
\ ],
\ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [
@@ -60,7 +60,7 @@ Execute(ale#lsp#response#ReadDiagnostics() should treat messages with missing se
\ 'col': 11,
\ 'end_lnum': 5,
\ 'end_col': 16,
- \ 'nr': 'some-error',
+ \ 'code': 'some-error',
\ }
\ ],
\ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [
@@ -89,6 +89,26 @@ Execute(ale#lsp#response#ReadDiagnostics() should handle messages without codes)
\ },
\ ]}})
+Execute(ale#lsp#response#ReadDiagnostics() should consider -1 to be a meaningless code):
+ AssertEqual [
+ \ {
+ \ 'type': 'E',
+ \ 'text': 'Something went wrong!',
+ \ 'lnum': 3,
+ \ 'col': 11,
+ \ 'end_lnum': 5,
+ \ 'end_col': 16,
+ \ }
+ \ ],
+ \ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [
+ \ {
+ \ 'range': Range(2, 10, 4, 15),
+ \ 'message': 'Something went wrong!',
+ \ 'code': -1,
+ \ },
+ \ ]}})
+
+
Execute(ale#lsp#response#ReadDiagnostics() should handle multiple messages):
AssertEqual [
\ {
@@ -126,6 +146,7 @@ Execute(ale#lsp#response#ReadTSServerDiagnostics() should handle tsserver respon
\ {
\ 'type': 'E',
\ 'nr': 2365,
+ \ 'code': '2365',
\ 'text': 'Operator ''''+'''' cannot be applied to types ''''3'''' and ''''{}''''.',
\ 'lnum': 1,
\ 'col': 11,
@@ -142,6 +163,7 @@ Execute(ale#lsp#response#ReadTSServerDiagnostics() should handle warnings from t
\ 'lnum': 27,
\ 'col': 3,
\ 'nr': 2515,
+ \ 'code': '2515',
\ 'end_lnum': 27,
\ 'type': 'W',
\ 'end_col': 14,
@@ -157,6 +179,7 @@ Execute(ale#lsp#response#ReadTSServerDiagnostics() should handle suggestions fro
\ 'lnum': 27,
\ 'col': 3,
\ 'nr': 2515,
+ \ 'code': '2515',
\ 'end_lnum': 27,
\ 'type': 'I',
\ 'end_col': 14,
diff --git a/test/test_engine_lsp_response_handling.vader b/test/test_engine_lsp_response_handling.vader
index 517d82c0..ddcd7b2e 100644
--- a/test/test_engine_lsp_response_handling.vader
+++ b/test/test_engine_lsp_response_handling.vader
@@ -62,6 +62,7 @@ Execute(tsserver syntax error responses should be handled correctly):
\ 'col': 14,
\ 'vcol': 0,
\ 'nr': 1005,
+ \ 'code': '1005',
\ 'type': 'E',
\ 'text': ''','' expected.',
\ 'valid': 1,
@@ -135,6 +136,7 @@ Execute(tsserver semantic error responses should be handled correctly):
\ 'col': 14,
\ 'vcol': 0,
\ 'nr': 1005,
+ \ 'code': '1005',
\ 'type': 'E',
\ 'text': 'Some semantic error',
\ 'valid': 1,
diff --git a/test/test_ignoring_linters.vader b/test/test_ignoring_linters.vader
index af31fce3..1ddd30e8 100644
--- a/test/test_ignoring_linters.vader
+++ b/test/test_ignoring_linters.vader
@@ -190,6 +190,7 @@ Execute(Buffer ignore lists should be applied for tsserver):
\ 'lnum': 2,
\ 'col': 14,
\ 'nr': 1005,
+ \ 'code': '1005',
\ 'type': 'E',
\ 'end_col': 15,
\ 'end_lnum': 2,