summaryrefslogtreecommitdiff
path: root/test/lsp/test_lsp_error_parsing.vader
blob: 7464b0e71b471d9c15a2ce90db78c38e9af36379 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Execute(Invalid responses should be handled):
  AssertEqual '', ale#lsp#response#GetErrorMessage({})
  AssertEqual '', ale#lsp#response#GetErrorMessage({'error': 0})
  AssertEqual '', ale#lsp#response#GetErrorMessage({'error': {}})
  AssertEqual '', ale#lsp#response#GetErrorMessage({
  \ 'error': {
  \   'code': 0,
  \   'message': 'x',
  \ },
  \})
  AssertEqual '', ale#lsp#response#GetErrorMessage({'error': {'code': -32602}})
  AssertEqual '', ale#lsp#response#GetErrorMessage({'error': {'code': -32603}})

Execute(Messages without tracebacks should be handled):
  AssertEqual 'xyz', ale#lsp#response#GetErrorMessage({
  \ 'error': {
  \   'code': -32602,
  \   'message': 'xyz',
  \ },
  \})
  AssertEqual 'abc', ale#lsp#response#GetErrorMessage({
  \ 'error': {
  \   'code': -32603,
  \   'message': 'abc',
  \ },
  \})

Execute(Invalid traceback data should be tolerated):
  AssertEqual 'xyz', ale#lsp#response#GetErrorMessage({
  \ 'error': {
  \   'code': -32602,
  \   'message': 'xyz',
  \   'data': {
  \   },
  \ },
  \})
  AssertEqual 'xyz', ale#lsp#response#GetErrorMessage({
  \ 'error': {
  \   'code': -32602,
  \   'message': 'xyz',
  \   'data': {
  \     'traceback': 0,
  \   },
  \ },
  \})
  AssertEqual 'xyz', ale#lsp#response#GetErrorMessage({
  \ 'error': {
  \   'code': -32602,
  \   'message': 'xyz',
  \   'data': {
  \     'traceback': [],
  \   },
  \ },
  \})

Execute(Messages with tracebacks should be handled):
  AssertEqual "xyz\n123\n456", ale#lsp#response#GetErrorMessage({
  \ 'error': {
  \   'code': -32602,
  \   'message': 'xyz',
  \   'data': {
  \     'traceback': ['123', '456'],
  \   },
  \ },
  \})