]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/fix/test_ale_fix_suggest.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 / fix / test_ale_fix_suggest.vader
1 Before:
2   call ale#fix#registry#Clear()
3
4   let g:buffer = bufnr('')
5
6   function GetSuggestions()
7     silent ALEFixSuggest
8
9     if bufnr('') != g:buffer
10       let l:lines = getline(1, '$')
11     else
12       let l:lines = []
13     endif
14
15     return l:lines
16   endfunction
17
18 After:
19   if bufnr('') != g:buffer
20     :q!
21   endif
22
23   unlet! g:buffer
24
25   call ale#fix#registry#ResetToDefaults()
26   delfunction GetSuggestions
27
28 Execute(ALEFixSuggest should return something sensible with no suggestions):
29   AssertEqual
30   \ [
31   \   'There is nothing in the registry to suggest.',
32   \   '',
33   \   'Press q to close this window',
34   \ ],
35   \ GetSuggestions()
36
37 Execute(ALEFixSuggest should set the appropriate settings):
38   silent ALEFixSuggest
39
40   AssertEqual 'ale-fix-suggest', &filetype
41   Assert !&modified, 'The buffer was marked as modified'
42   Assert !&modifiable, 'The buffer was modifiable'
43
44 Execute(ALEFixSuggest output should be correct for only generic handlers):
45   call ale#fix#registry#Add('zed', 'XYZ', [], 'Zedify things.')
46   call ale#fix#registry#Add('alpha', 'XYZ', [], 'Alpha things.')
47
48   AssertEqual
49   \ [
50   \   'Try the following generic fixers:',
51   \   '',
52   \   '''alpha'' - Alpha things.',
53   \   '''zed'' - Zedify things.',
54   \   '',
55   \   'See :help ale-fix-configuration',
56   \   '',
57   \   'Press q to close this window',
58   \ ],
59   \ GetSuggestions()
60
61 Execute(ALEFixSuggest output should be correct for only filetype handlers):
62   let &filetype = 'testft2.testft'
63
64   call ale#fix#registry#Add('zed', 'XYZ', ['testft2'], 'Zedify things.')
65   call ale#fix#registry#Add('alpha', 'XYZ', ['testft'], 'Alpha things.')
66
67   AssertEqual
68   \ [
69   \   'Try the following fixers appropriate for the filetype:',
70   \   '',
71   \   '''alpha'' - Alpha things.',
72   \   '''zed'' - Zedify things.',
73   \   '',
74   \   'See :help ale-fix-configuration',
75   \   '',
76   \   'Press q to close this window',
77   \ ],
78   \ GetSuggestions()
79
80 Execute(ALEFixSuggest should suggest filetype and generic handlers):
81   let &filetype = 'testft2.testft'
82
83   call ale#fix#registry#Add('zed', 'XYZ', ['testft2'], 'Zedify things.', ['foobar'])
84   call ale#fix#registry#Add('alpha', 'XYZ', ['testft'], 'Alpha things.')
85   call ale#fix#registry#Add('generic', 'XYZ', [], 'Generic things.')
86
87   AssertEqual
88   \ [
89   \   'Try the following fixers appropriate for the filetype:',
90   \   '',
91   \   '''alpha'' - Alpha things.',
92   \   '''zed'', ''foobar'' - Zedify things.',
93   \   '',
94   \   'Try the following generic fixers:',
95   \   '',
96   \   '''generic'' - Generic things.',
97   \   '',
98   \   'See :help ale-fix-configuration',
99   \   '',
100   \   'Press q to close this window',
101   \ ],
102   \ GetSuggestions()