]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/test_redundant_tsserver_rendering_avoided.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '56df844d3c39ec494dacc69eae34272b27db185a' as '.vim/bundle/asyncomplete'
[etc/vim.git] / .vim / bundle / ale / test / test_redundant_tsserver_rendering_avoided.vader
1 Before:
2   Save g:ale_buffer_info
3   Save g:ale_disable_lsp
4   Save g:ale_lsp_suggestions
5
6   let g:ale_disable_lsp = 0
7   let g:ale_lsp_suggestions = 1
8   unlet! b:ale_disable_lsp
9
10   function! CreateError(type, message) abort
11     let l:diagnostics = []
12
13     if !empty(a:message)
14       let l:diagnostics = [{
15       \ 'start': {'line': 1, 'offset': 1},
16       \ 'end': {'line': 1, 'offset':1},
17       \ 'text': a:message,
18       \ 'code': 1005,
19       \}]
20     endif
21
22     return {
23     \ 'seq': 0,
24     \ 'type': 'event',
25     \ 'event': a:type,
26     \ 'body': {'file': expand('%:p'), 'diagnostics': l:diagnostics},
27     \}
28   endfunction
29
30   function! CreateLoclist(message) abort
31     let l:list = []
32
33     if !empty(a:message)
34       let l:list = [{
35       \ 'lnum': 1,
36       \ 'col': 1,
37       \ 'end_lnum': 1,
38       \ 'end_col': 1,
39       \ 'text': a:message,
40       \}]
41     endif
42
43     return l:list
44   endfunction
45
46   call ale#test#SetDirectory('/testplugin/test')
47   call ale#test#SetFilename('filename.ts')
48
49   runtime autoload/ale/engine.vim
50
51   let g:ale_buffer_info = {bufnr(''): {'loclist': [], 'active_linter_list': []}}
52   let g:ale_handle_loclist_called = 0
53
54   function! ale#engine#HandleLoclist(linter_name, buffer, loclist, from_other_source) abort
55     let g:ale_handle_loclist_called = 1
56   endfunction
57
58 After:
59   Restore
60
61   delfunction CreateError
62   delfunction CreateLoclist
63
64   call ale#test#RestoreDirectory()
65
66   runtime autoload/ale/engine.vim
67
68 Execute(An initial empty list of syntax errors should be ignored):
69   call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', ''))
70
71   Assert !g:ale_handle_loclist_called
72
73 Execute(An initial list of syntax errors should be handled):
74   call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', 'x'))
75
76   Assert g:ale_handle_loclist_called
77
78 Execute(Subsequent empty lists should be ignored):
79   let g:ale_buffer_info[bufnr('')].syntax_loclist = []
80
81   call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', ''))
82
83   Assert !g:ale_handle_loclist_called
84
85 Execute(Empty then non-empty syntax errors should be handled):
86   let g:ale_buffer_info[bufnr('')].syntax_loclist = []
87
88   call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', 'x'))
89
90   Assert g:ale_handle_loclist_called
91
92 Execute(Non-empty then empty syntax errors should be handled):
93   let g:ale_buffer_info[bufnr('')].syntax_loclist = CreateLoclist('x')
94
95   call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', ''))
96
97   Assert g:ale_handle_loclist_called
98
99 Execute(Non-empty then non-empty syntax errors should be handled):
100   let g:ale_buffer_info[bufnr('')].syntax_loclist = CreateLoclist('x')
101
102   call ale#lsp_linter#HandleLSPResponse(1, CreateError('syntaxDiag', 'x'))
103
104   Assert g:ale_handle_loclist_called
105
106 Execute(An initial empty list of semantic errors should be ignored):
107   call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', ''))
108
109   Assert !g:ale_handle_loclist_called
110
111 Execute(An initial list of semantic errors should be handled):
112   call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', 'x'))
113
114   Assert g:ale_handle_loclist_called
115
116 Execute(Subsequent empty lists should be ignored - semantic):
117   let g:ale_buffer_info[bufnr('')].semantic_loclist = []
118
119   call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', ''))
120
121   Assert !g:ale_handle_loclist_called
122
123 Execute(Empty then non-empty semantic errors should be handled):
124   let g:ale_buffer_info[bufnr('')].semantic_loclist = []
125
126   call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', 'x'))
127
128   Assert g:ale_handle_loclist_called
129
130 Execute(Non-empty then empty semantic errors should be handled):
131   let g:ale_buffer_info[bufnr('')].semantic_loclist = CreateLoclist('x')
132
133   call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', ''))
134
135   Assert g:ale_handle_loclist_called
136
137 Execute(Non-empty then non-empty semantic errors should be handled):
138   let g:ale_buffer_info[bufnr('')].semantic_loclist = CreateLoclist('x')
139
140   call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', 'x'))
141
142   Assert g:ale_handle_loclist_called
143
144 Execute(Subsequent empty lists should be ignored - suggestion):
145   let g:ale_buffer_info[bufnr('')].suggestion_loclist = []
146
147   call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', ''))
148
149   Assert !g:ale_handle_loclist_called
150
151 Execute(You should be able to disable suggestions):
152   let g:ale_lsp_suggestions = 0
153   let g:ale_buffer_info[bufnr('')].suggestion_loclist = []
154
155   call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', 'x'))
156
157   Assert !g:ale_handle_loclist_called
158
159 Execute(Empty then non-empty suggestion messages should be handled):
160   let g:ale_buffer_info[bufnr('')].suggestion_loclist = []
161
162   call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', 'x'))
163
164   Assert g:ale_handle_loclist_called
165
166 Execute(Non-empty then empt suggestion messages should be handled):
167   let g:ale_buffer_info[bufnr('')].suggestion_loclist = CreateLoclist('x')
168
169   call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', ''))
170
171   Assert g:ale_handle_loclist_called
172
173 Execute(Non-empty then non-empty suggestion messages should be handled):
174   let g:ale_buffer_info[bufnr('')].suggestion_loclist = CreateLoclist('x')
175
176   call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', 'x'))
177
178   Assert g:ale_handle_loclist_called