2017-05-20 17:56:44 +00:00
|
|
|
Before:
|
|
|
|
call ale#fix#registry#Clear()
|
|
|
|
|
2017-06-28 15:20:01 +00:00
|
|
|
let g:buffer = bufnr('')
|
|
|
|
|
2017-05-20 17:56:44 +00:00
|
|
|
function GetSuggestions()
|
2017-06-28 15:20:01 +00:00
|
|
|
silent ALEFixSuggest
|
|
|
|
|
|
|
|
if bufnr('') != g:buffer
|
|
|
|
let l:lines = getline(1, '$')
|
|
|
|
else
|
|
|
|
let l:lines = []
|
|
|
|
endif
|
2017-05-20 17:56:44 +00:00
|
|
|
|
2017-06-28 15:20:01 +00:00
|
|
|
return l:lines
|
2017-05-20 17:56:44 +00:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
After:
|
2017-06-28 15:20:01 +00:00
|
|
|
if bufnr('') != g:buffer
|
|
|
|
:q!
|
|
|
|
endif
|
|
|
|
|
|
|
|
unlet! g:buffer
|
|
|
|
|
2017-05-20 17:56:44 +00:00
|
|
|
call ale#fix#registry#ResetToDefaults()
|
|
|
|
delfunction GetSuggestions
|
|
|
|
|
|
|
|
Execute(ALEFixSuggest should return something sensible with no suggestions):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ 'There is nothing in the registry to suggest.',
|
2017-06-28 15:20:01 +00:00
|
|
|
\ '',
|
|
|
|
\ 'Press q to close this window',
|
2017-05-20 17:56:44 +00:00
|
|
|
\ ],
|
|
|
|
\ GetSuggestions()
|
|
|
|
|
2017-06-28 15:20:01 +00:00
|
|
|
Execute(ALEFixSuggest should set the appropriate settings):
|
|
|
|
silent ALEFixSuggest
|
|
|
|
|
|
|
|
AssertEqual 'ale-fix-suggest', &filetype
|
|
|
|
Assert !&modified, 'The buffer was marked as modified'
|
|
|
|
Assert !&modifiable, 'The buffer was modifiable'
|
|
|
|
|
2017-05-20 17:56:44 +00:00
|
|
|
Execute(ALEFixSuggest output should be correct for only generic handlers):
|
|
|
|
call ale#fix#registry#Add('zed', 'XYZ', [], 'Zedify things.')
|
|
|
|
call ale#fix#registry#Add('alpha', 'XYZ', [], 'Alpha things.')
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ 'Try the following generic fixers:',
|
|
|
|
\ '',
|
|
|
|
\ '''alpha'' - Alpha things.',
|
|
|
|
\ '''zed'' - Zedify things.',
|
|
|
|
\ '',
|
|
|
|
\ 'See :help ale-fix-configuration',
|
2017-06-28 15:20:01 +00:00
|
|
|
\ '',
|
|
|
|
\ 'Press q to close this window',
|
2017-05-20 17:56:44 +00:00
|
|
|
\ ],
|
|
|
|
\ GetSuggestions()
|
|
|
|
|
|
|
|
Execute(ALEFixSuggest output should be correct for only filetype handlers):
|
|
|
|
let &filetype = 'testft2.testft'
|
|
|
|
|
|
|
|
call ale#fix#registry#Add('zed', 'XYZ', ['testft2'], 'Zedify things.')
|
|
|
|
call ale#fix#registry#Add('alpha', 'XYZ', ['testft'], 'Alpha things.')
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ 'Try the following fixers appropriate for the filetype:',
|
|
|
|
\ '',
|
|
|
|
\ '''alpha'' - Alpha things.',
|
|
|
|
\ '''zed'' - Zedify things.',
|
|
|
|
\ '',
|
|
|
|
\ 'See :help ale-fix-configuration',
|
2017-06-28 15:20:01 +00:00
|
|
|
\ '',
|
|
|
|
\ 'Press q to close this window',
|
2017-05-20 17:56:44 +00:00
|
|
|
\ ],
|
|
|
|
\ GetSuggestions()
|
|
|
|
|
|
|
|
Execute(ALEFixSuggest should suggest filetype and generic handlers):
|
|
|
|
let &filetype = 'testft2.testft'
|
|
|
|
|
|
|
|
call ale#fix#registry#Add('zed', 'XYZ', ['testft2'], 'Zedify things.')
|
|
|
|
call ale#fix#registry#Add('alpha', 'XYZ', ['testft'], 'Alpha things.')
|
|
|
|
call ale#fix#registry#Add('generic', 'XYZ', [], 'Generic things.')
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ 'Try the following fixers appropriate for the filetype:',
|
|
|
|
\ '',
|
|
|
|
\ '''alpha'' - Alpha things.',
|
|
|
|
\ '''zed'' - Zedify things.',
|
|
|
|
\ '',
|
|
|
|
\ 'Try the following generic fixers:',
|
|
|
|
\ '',
|
|
|
|
\ '''generic'' - Generic things.',
|
|
|
|
\ '',
|
|
|
|
\ 'See :help ale-fix-configuration',
|
2017-06-28 15:20:01 +00:00
|
|
|
\ '',
|
|
|
|
\ 'Press q to close this window',
|
2017-05-20 17:56:44 +00:00
|
|
|
\ ],
|
|
|
|
\ GetSuggestions()
|