]> git.madduck.net Git - etc/vim.git/blob - test/test_neovim_diagnostics.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:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / test / test_neovim_diagnostics.vader
1 Before:
2   Save g:ale_use_neovim_diagnostics_api
3
4   function! CollectMessages(buffer)
5     let l:messages = []
6     for l:diag in v:lua.vim.diagnostic.get(a:buffer)
7         call add(l:messages, l:diag.message)
8     endfor
9
10     return l:messages
11   endfunction
12
13
14 After:
15   unlet! b:other_bufnr
16   delfunction CollectMessages
17   Restore
18
19 Execute(Should only set diagnostics belonging to the given buffer):
20   if has('nvim-0.6')
21     let b:other_bufnr = bufnr('/foo/bar/baz', 1)
22     " Make sure we actually get another buffer number, or the test is invalid.
23     AssertNotEqual -1, b:other_bufnr
24
25     let g:ale_use_neovim_diagnostics_api = 1
26
27     call ale#engine#SetResults(bufnr('%'), [
28     \  {
29     \    'lnum': 1,
30     \    'col': 10,
31     \    'bufnr': bufnr('%'),
32     \    'vcol': 0,
33     \    'linter_name': 'bettercode',
34     \    'nr': -1,
35     \    'type': 'W',
36     \    'text': 'A',
37     \  },
38     \  {
39     \    'lnum': 2,
40     \    'col': 10,
41     \    'bufnr': b:other_bufnr,
42     \    'vcol': 0,
43     \    'linter_name': 'bettercode',
44     \    'nr': -1,
45     \    'type': 'W',
46     \    'text': 'B',
47     \  },
48     \  {
49     \    'lnum': 3,
50     \    'col': 1,
51     \    'bufnr': bufnr('%'),
52     \    'vcol': 0,
53     \    'linter_name': 'bettercode',
54     \    'nr': -1,
55     \    'type': 'E',
56     \    'text': 'C',
57     \  },
58     \  {
59     \    'lnum': 4,
60     \    'col': 1,
61     \    'bufnr': b:other_bufnr,
62     \    'vcol': 0,
63     \    'linter_name': 'bettercode',
64     \    'nr': -1,
65     \    'type': 'E',
66     \    'text': 'D',
67     \  },
68     \])
69
70     AssertEqual ["A", "C"], CollectMessages(bufnr('%'))
71   endif