]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/sign/test_sign_limits.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 '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / sign / test_sign_limits.vader
1 Before:
2   Save g:ale_max_signs
3
4   let g:ale_max_signs = -1
5
6   function! SetNProblems(sign_count)
7     let l:loclist = []
8     let l:range = range(1, a:sign_count)
9     call setline(1, l:range)
10
11     for l:index in l:range
12       call add(l:loclist, {
13       \ 'bufnr': bufnr(''),
14       \ 'lnum': l:index,
15       \ 'col': 1,
16       \ 'type': 'E',
17       \ 'text': 'a',
18       \})
19     endfor
20
21     call ale#sign#SetSigns(bufnr(''), l:loclist)
22
23     return sort(map(ale#sign#FindCurrentSigns(bufnr(''))[1], 'v:val[0]'), 'n')
24   endfunction
25
26 After:
27   Restore
28
29   unlet! b:ale_max_signs
30
31   delfunction SetNProblems
32
33   call ale#sign#Clear()
34
35 Execute(There should be no limit on signs with negative numbers):
36   AssertEqual range(1, 42), SetNProblems(42)
37
38 Execute(0 signs should be set when the max is 0):
39   let g:ale_max_signs = 0
40
41   AssertEqual [], SetNProblems(42)
42
43 Execute(10 signs should be set when the max is 10):
44   let g:ale_max_signs = 10
45
46   " We'll check that we set signs for the first 10 items, not other lines.
47   AssertEqual range(1, 10), SetNProblems(42)
48
49 Execute(5 signs should be set when the max is 5 for the buffer):
50   let b:ale_max_signs = 5
51
52   AssertEqual range(1, 5), SetNProblems(42)