]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/test_linting_updates_loclist.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 'a39f715c13be3352193ffd9c5b7536b8786eff64' as '.vim/bundle/vim-lsp'
[etc/vim.git] / .vim / bundle / ale / test / test_linting_updates_loclist.vader
1 Before:
2   Save g:ale_echo_cursor
3   Save g:ale_set_highlights
4   Save g:ale_set_loclist
5   Save g:ale_set_quickfix
6   Save g:ale_set_signs
7   Save g:ale_run_synchronously
8   Save g:ale_set_lists_synchronously
9   Save g:ale_buffer_info
10   Save g:ale_sign_offset
11
12   " We want to check that sign IDs are set for this test.
13   let g:ale_set_signs = 1
14   let g:ale_set_loclist = 1
15   let g:ale_sign_offset = 2000000
16   " Disable features we don't need for these tests.
17   let g:ale_set_quickfix = 0
18   let g:ale_set_highlights = 0
19   let g:ale_echo_cursor = 0
20
21   let g:ale_run_synchronously = 1
22   let g:ale_set_lists_synchronously = 1
23   let g:ale_buffer_info = {}
24
25   function! TestCallback(buffer, output)
26     return [
27     \ {
28     \   'lnum': 1,
29     \   'type': 'W',
30     \   'col': 10,
31     \   'text': 'Infix operators must be spaced. [Warning/space-infix-ops]',
32     \ },
33     \ {
34     \   'lnum': 2,
35     \   'type': 'E',
36     \   'col': 10,
37     \   'text': 'Missing semicolon. [Error/semi]',
38     \ }
39     \]
40   endfunction
41
42   call ale#linter#Define('foobar', {
43   \ 'name': 'testlinter',
44   \ 'callback': 'TestCallback',
45   \ 'executable': has('win32') ? 'cmd': 'true',
46   \ 'command': 'true',
47   \ 'read_buffer': 0,
48   \})
49
50   sign unplace *
51
52   call ale#engine#Cleanup(bufnr(''))
53
54 After:
55   Restore
56
57   delfunction TestCallback
58
59   call ale#linter#Reset()
60
61   sign unplace *
62
63 Given foobar (Some JavaScript with problems):
64   var y = 3+3;
65   var y = 3
66
67 Execute(The loclist should be updated after linting is done):
68   ALELint
69   call ale#test#FlushJobs()
70
71   AssertEqual
72   \ [
73   \   {
74   \     'lnum': 1,
75   \     'bufnr': bufnr('%'),
76   \     'vcol': 0,
77   \     'linter_name': 'testlinter',
78   \     'nr': -1,
79   \     'type': 'W',
80   \     'col': 10,
81   \     'text': 'Infix operators must be spaced. [Warning/space-infix-ops]',
82   \     'sign_id': 2000001,
83   \   },
84   \   {
85   \     'lnum': 2,
86   \     'bufnr': bufnr('%'),
87   \     'vcol': 0,
88   \     'linter_name': 'testlinter',
89   \     'nr': -1,
90   \     'type': 'E',
91   \     'col': 10,
92   \     'text': 'Missing semicolon. [Error/semi]',
93   \     'sign_id': 2000002,
94   \   }
95   \ ],
96   \ get(get(g:ale_buffer_info, bufnr('%'), {}), 'loclist', [])