summaryrefslogtreecommitdiff
path: root/test/test_ale_fix_suggest.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-05-20 18:56:44 +0100
committerw0rp <devw0rp@gmail.com>2017-05-20 19:02:36 +0100
commit3530180a73ec53c6c029926173c34e0d78a8ac70 (patch)
tree5ae4f51684b1b0f9d00c03aec22e8afa899e6858 /test/test_ale_fix_suggest.vader
parent59d9f5d458036bb6a2fbb0d3c3e301f4717eb916 (diff)
downloadale-3530180a73ec53c6c029926173c34e0d78a8ac70.zip
Suggest functions for fixing issues for ALEFix
Diffstat (limited to 'test/test_ale_fix_suggest.vader')
-rw-r--r--test/test_ale_fix_suggest.vader75
1 files changed, 75 insertions, 0 deletions
diff --git a/test/test_ale_fix_suggest.vader b/test/test_ale_fix_suggest.vader
new file mode 100644
index 00000000..9a7aecbf
--- /dev/null
+++ b/test/test_ale_fix_suggest.vader
@@ -0,0 +1,75 @@
+Before:
+ call ale#fix#registry#Clear()
+
+ function GetSuggestions()
+ redir => l:output
+ silent ALEFixSuggest
+ redir END
+
+ return split(l:output, "\n")
+ endfunction
+
+After:
+ 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.',
+ \ ],
+ \ GetSuggestions()
+
+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',
+ \ ],
+ \ 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',
+ \ ],
+ \ 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',
+ \ ],
+ \ GetSuggestions()