From 8846a8860f39027c0c2a7aba9e49ad2fdacd5428 Mon Sep 17 00:00:00 2001 From: w0rp Date: Wed, 28 Jun 2017 16:20:01 +0100 Subject: Use a new window for the ALEFixSuggest command, and document it better --- test/test_ale_fix_suggest.vader | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/test_ale_fix_suggest.vader b/test/test_ale_fix_suggest.vader index 9a7aecbf..97227b4f 100644 --- a/test/test_ale_fix_suggest.vader +++ b/test/test_ale_fix_suggest.vader @@ -1,15 +1,27 @@ Before: call ale#fix#registry#Clear() + let g:buffer = bufnr('') + function GetSuggestions() - redir => l:output - silent ALEFixSuggest - redir END + silent ALEFixSuggest + + if bufnr('') != g:buffer + let l:lines = getline(1, '$') + else + let l:lines = [] + endif - return split(l:output, "\n") + return l:lines endfunction After: + if bufnr('') != g:buffer + :q! + endif + + unlet! g:buffer + call ale#fix#registry#ResetToDefaults() delfunction GetSuggestions @@ -17,9 +29,18 @@ Execute(ALEFixSuggest should return something sensible with no suggestions): AssertEqual \ [ \ 'There is nothing in the registry to suggest.', + \ '', + \ 'Press q to close this window', \ ], \ GetSuggestions() +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' + 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.') @@ -32,6 +53,8 @@ Execute(ALEFixSuggest output should be correct for only generic handlers): \ '''zed'' - Zedify things.', \ '', \ 'See :help ale-fix-configuration', + \ '', + \ 'Press q to close this window', \ ], \ GetSuggestions() @@ -49,6 +72,8 @@ Execute(ALEFixSuggest output should be correct for only filetype handlers): \ '''zed'' - Zedify things.', \ '', \ 'See :help ale-fix-configuration', + \ '', + \ 'Press q to close this window', \ ], \ GetSuggestions() @@ -71,5 +96,7 @@ Execute(ALEFixSuggest should suggest filetype and generic handlers): \ '''generic'' - Generic things.', \ '', \ 'See :help ale-fix-configuration', + \ '', + \ 'Press q to close this window', \ ], \ GetSuggestions() -- cgit v1.2.3