]> git.madduck.net Git - etc/vim.git/blob - test/test_setting_problems_found_in_previous_buffers.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_setting_problems_found_in_previous_buffers.vader
1 Before:
2   Save g:ale_buffer_info
3   Save &filetype
4   Save g:ale_set_lists_synchronously
5
6   let g:ale_set_lists_synchronously = 1
7
8   " Set up items in other buffers which should set in this one.
9   let g:ale_buffer_info = {}
10   call ale#engine#InitBufferInfo(bufnr('') + 1)
11   let g:ale_buffer_info[bufnr('') + 1].loclist =
12   \ ale#engine#FixLocList(bufnr('') + 1, 'linter_one', 0, [
13   \   {'lnum': 1, 'filename': expand('%:p'), 'text': 'foo'},
14   \   {'lnum': 2, 'filename': expand('%:p'), 'text': 'bar'},
15   \   {'lnum': 2, 'text': 'ignore this one'},
16   \ ])
17   call ale#engine#InitBufferInfo(bufnr('') + 2)
18   let g:ale_buffer_info[bufnr('') + 2].loclist =
19   \ ale#engine#FixLocList(bufnr('') + 2, 'linter_one', 0, [
20   \   {'lnum': 1, 'filename': expand('%:p'), 'text': 'foo'},
21   \   {'lnum': 3, 'filename': expand('%:p'), 'text': 'baz'},
22   \   {'lnum': 5, 'text': 'ignore this one'},
23   \ ])
24
25   call ale#linter#Define('foobar', {
26   \ 'name': 'linter_one',
27   \ 'callback': 'WhoCares',
28   \ 'executable': 'echo',
29   \ 'command': 'sleep 1000',
30   \ 'lint_file': 1,
31   \})
32
33 After:
34   call ale#engine#Cleanup(bufnr(''))
35   Restore
36   call ale#linter#Reset()
37
38   " Items and markers, etc.
39   call setloclist(0, [])
40   call clearmatches()
41   call ale#sign#Clear()
42
43 Given foobar(A file with some lines):
44   foo
45   bar
46   baz
47
48 Execute(Problems found from previously opened buffers should be set when linting for the first time):
49   call ale#engine#RunLinters(bufnr(''), ale#linter#Get(&filetype), 0)
50
51   AssertEqual
52   \ [
53   \   {
54   \     'lnum': 1,
55   \     'bufnr': bufnr(''),
56   \     'col': 0,
57   \     'filename': expand('%:p'),
58   \     'linter_name': 'linter_one',
59   \     'nr': -1,
60   \     'type': 'E',
61   \     'vcol': 0,
62   \     'text': 'foo',
63   \     'sign_id': 1000001,
64   \   },
65   \   {
66   \     'lnum': 2,
67   \     'bufnr': bufnr(''),
68   \     'col': 0,
69   \     'filename': expand('%:p'),
70   \     'linter_name': 'linter_one',
71   \     'nr': -1,
72   \     'type': 'E',
73   \     'vcol': 0,
74   \     'text': 'bar',
75   \     'sign_id': 1000002,
76   \   },
77   \   {
78   \     'lnum': 3,
79   \     'bufnr': bufnr(''),
80   \     'col': 0,
81   \     'filename': expand('%:p'),
82   \     'linter_name': 'linter_one',
83   \     'nr': -1,
84   \     'type': 'E',
85   \     'vcol': 0,
86   \     'text': 'baz',
87   \     'sign_id': 1000003,
88   \   },
89   \ ],
90   \ g:ale_buffer_info[bufnr('')].loclist
91
92   AssertEqual
93   \ [
94   \   {'lnum': 1, 'bufnr': bufnr(''), 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'E', 'pattern': '', 'text': 'foo'},
95   \   {'lnum': 2, 'bufnr': bufnr(''), 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'E', 'pattern': '', 'text': 'bar'},
96   \   {'lnum': 3, 'bufnr': bufnr(''), 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'E', 'pattern': '', 'text': 'baz'},
97   \ ],
98   \ ale#test#GetLoclistWithoutNewerKeys()